1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Use Distinct instead of Set for map keys (#5027)

This commit is contained in:
Tyler Yahn
2024-03-06 02:11:16 -08:00
committed by GitHub
parent da2949b7bb
commit fe9bab54b7
12 changed files with 196 additions and 143 deletions

View File

@@ -258,7 +258,7 @@ func TestBucketsBin(t *testing.T) {
func testBucketsBin[N int64 | float64]() func(t *testing.T) {
return func(t *testing.T) {
b := newBuckets[N](3)
b := newBuckets[N](alice, 3)
assertB := func(counts []uint64, count uint64, min, max N) {
t.Helper()
assert.Equal(t, counts, b.counts)
@@ -282,7 +282,7 @@ func TestBucketsSum(t *testing.T) {
func testBucketsSum[N int64 | float64]() func(t *testing.T) {
return func(t *testing.T) {
b := newBuckets[N](3)
b := newBuckets[N](alice, 3)
var want N
assert.Equal(t, want, b.total)
@@ -325,12 +325,12 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) {
h.cumulative(&data)
hdp := data.(metricdata.Histogram[int64]).DataPoints[0]
require.Equal(t, hdp.BucketCounts, h.values[alice].counts)
require.Equal(t, hdp.BucketCounts, h.values[alice.Equivalent()].counts)
cpCounts := make([]uint64, len(hdp.BucketCounts))
copy(cpCounts, hdp.BucketCounts)
hdp.BucketCounts[0] = 10
assert.Equal(t, cpCounts, h.values[alice].counts, "modifying the Aggregator bucket counts should not change the Aggregator")
assert.Equal(t, cpCounts, h.values[alice.Equivalent()].counts, "modifying the Aggregator bucket counts should not change the Aggregator")
}
func TestDeltaHistogramReset(t *testing.T) {