Skip to content

Commit

Permalink
set empty histogram
Browse files Browse the repository at this point in the history
Signed-off-by: Loc Mai <locmai0201@gmail.com>
  • Loading branch information
locmai committed Mar 31, 2023
1 parent ba8d644 commit d9d5b95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion exporter/prometheusexporter/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (a *lastValueAccumulator) accumulateHistogram(metric pmetric.Metric, il pco
continue
}

ip.CopyTo(m.SetEmptyHistogram().DataPoints().AppendEmpty())
ip.CopyTo(m.Histogram().DataPoints().AppendEmpty())
default:
// unsupported temporality
continue
Expand Down
3 changes: 2 additions & 1 deletion exporter/prometheusexporter/accumulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestAccumulateHistogram(t *testing.T) {
t.Run("ResetBuckets/Ignore", func(t *testing.T) {
// should ignore metric from the past
n := a.Accumulate(resourceMetrics2)

require.Equal(t, 1, n)

m, ok := a.registeredMetrics.Load(signature)
Expand Down Expand Up @@ -630,4 +631,4 @@ func getMetricProperties(metric pmetric.Metric) (
}

return
}
}

0 comments on commit d9d5b95

Please sign in to comment.