| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package aggregate |
| 5 |
|
| 6 |
import ( |
| 7 |
"testing" |
| 8 |
|
| 9 |
"github.com/stretchr/testify/assert" |
| 10 |
|
| 11 |
"go.opentelemetry.io/otel/attribute" |
| 12 |
"go.opentelemetry.io/otel/sdk/metric/exemplar" |
| 13 |
) |
| 14 |
|
| 15 |
func TestDrop(t *testing.T) { |
| 16 |
t.Run("Int64", testDropFiltered[int64]) |
| 17 |
t.Run("Float64", testDropFiltered[float64]) |
| 18 |
} |
| 19 |
|
| 20 |
func testDropFiltered[N int64 | float64](t *testing.T) { |
| 21 |
r := dropReservoir[N](*attribute.EmptySet()) |
| 22 |
|
| 23 |
var dest []exemplar.Exemplar |
| 24 |
r.Collect(&dest) |
| 25 |
|
| 26 |
assert.Empty(t, dest, "non-sampled context should not be offered") |
| 27 |
} |