Skip to content

Commit

Permalink
handle delta-cumulative histogram interval misalignments
Browse files Browse the repository at this point in the history
Signed-off-by: xchen <[email protected]>
  • Loading branch information
hkfgo committed Jun 27, 2023
1 parent e42fcea commit 504e3b5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions exporter/prometheusexporter/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pco
return 0
}

v, ok := a.registeredMetrics.Load(signature) // a accumulates metric values for all times series. Get value for particualr time series
v, ok := a.registeredMetrics.Load(signature) // a accumulates metric values for all times series. Get value for particular time series
if !ok {
// first data point
m := copyMetricMetadata(metric)
Expand All @@ -266,11 +266,7 @@ func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pco
case pmetric.AggregationTemporalityDelta:
if ip.StartTimestamp().AsTime().Before(mv.value.Histogram().DataPoints().At(0).Timestamp().AsTime()) {
// only keep datapoint with latest timestamp
logger.Warn("Dropping misaligned histogram datapoint for time series",
zap.String("DataType", pmd.Type().String()),
zap.String("Name", pmd.Name()),
zap.String("Unit", pmd.Unit()),
)
a.logger.Warn(zap.String("Dropping misaligned histogram datapoint for time series ", signature))
continue
}
// assuming an application restart and reset counter
Expand Down

0 comments on commit 504e3b5

Please sign in to comment.