Skip to content

Commit 82b5d26

Browse files
Fix
1 parent 4881cc1 commit 82b5d26

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

spanner/metrics_monitoring_exporter.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func (me *monitoringExporter) Aggregation(ik otelmetric.InstrumentKind) otelmetr
173173
// exportTimeSeries create TimeSeries from the records in cps.
174174
// res should be the common resource among all TimeSeries, such as instance id, application name and so on.
175175
func (me *monitoringExporter) exportTimeSeries(ctx context.Context, rm *otelmetricdata.ResourceMetrics) error {
176+
me.mu.Lock()
177+
me.lastExportedAt = time.Now()
178+
me.mu.Unlock()
179+
176180
tss, err := me.recordsToTimeSeriesPbs(rm)
177181
if len(tss) == 0 {
178182
return err
@@ -202,9 +206,6 @@ func (me *monitoringExporter) exportTimeSeries(ctx context.Context, rm *otelmetr
202206
errs = append(errs, err)
203207
}
204208

205-
me.mu.Lock()
206-
me.lastExportedAt = time.Now()
207-
me.mu.Unlock()
208209
return errors.Join(errs...)
209210
}
210211

0 commit comments

Comments
 (0)