Skip to content

Commit

Permalink
goldendataset: fix histogram metric BucketCounts length
Browse files Browse the repository at this point in the history
  • Loading branch information
narcis96 committed Oct 4, 2024
1 parent fb37793 commit ad9a28d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/coreinternal/goldendataset/metrics_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func populateDoubleHistogram(cfg MetricsCfg, dh pmetric.Histogram) {
}

func setDoubleHistogramBounds(hdp pmetric.HistogramDataPoint, bounds ...float64) {
counts := make([]uint64, len(bounds))
counts := make([]uint64, len(bounds)+1)
hdp.BucketCounts().FromRaw(counts)
hdp.ExplicitBounds().FromRaw(bounds)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/coreinternal/goldendataset/metrics_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestDoubleHistogramFunctions(t *testing.T) {
pt := pmetric.NewHistogramDataPoint()
setDoubleHistogramBounds(pt, 1, 2, 3, 4, 5)
require.Equal(t, 5, pt.ExplicitBounds().Len())
require.Equal(t, 5, pt.BucketCounts().Len())
require.Equal(t, 6, pt.BucketCounts().Len())

addDoubleHistogramVal(pt, 1)
require.EqualValues(t, 1, pt.Count())
Expand All @@ -75,7 +75,7 @@ func TestGenDoubleHistogram(t *testing.T) {
pts := getMetric(md).Histogram().DataPoints()
pt := pts.At(0)
buckets := pt.BucketCounts()
require.Equal(t, 5, buckets.Len())
require.Equal(t, 6, buckets.Len())
require.EqualValues(t, 2, buckets.At(2))
}

Expand Down

0 comments on commit ad9a28d

Please sign in to comment.