Skip to content

Commit

Permalink
use metric.Aggregation instead of aggregation.Aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Aug 29, 2023
1 parent 6c442e5 commit 94a13c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions module/apmotel/gatherer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package apmotel // import "go.elastic.co/apm/module/apmotel/v2"

import (
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
)

Expand Down Expand Up @@ -72,10 +71,10 @@ func WithAggregationSelector(agg metric.AggregationSelector) GathererOption {
}
}

func defaultAggregationSelector(ik metric.InstrumentKind) aggregation.Aggregation {
func defaultAggregationSelector(ik metric.InstrumentKind) metric.Aggregation {
switch ik {
case metric.InstrumentKindHistogram:
return aggregation.ExplicitBucketHistogram{
return metric.AggregationExplicitBucketHistogram{
Boundaries: customHistogramBoundaries,
NoMinMax: false,
}
Expand Down
5 changes: 2 additions & 3 deletions module/apmotel/gatherer_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
)

func TestNewGathererConfig(t *testing.T) {
aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil }
aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil }
temporalitySelector := func(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality }

testCases := []struct {
Expand Down Expand Up @@ -68,7 +67,7 @@ func TestNewGathererConfig(t *testing.T) {
}

func TestConfigManualReaderOptions(t *testing.T) {
aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil }
aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil }
temporalitySelector := func(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality }

testCases := []struct {
Expand Down
3 changes: 1 addition & 2 deletions module/apmotel/gatherer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"

"go.elastic.co/apm/v2"
"go.elastic.co/apm/v2/apmtest"
Expand Down Expand Up @@ -245,7 +244,7 @@ func TestGathererWithCustomView(t *testing.T) {
sdkmetric.WithReader(gatherer),
sdkmetric.WithView(sdkmetric.NewView(
sdkmetric.Instrument{Name: "*"},
sdkmetric.Stream{Aggregation: aggregation.ExplicitBucketHistogram{
sdkmetric.Stream{Aggregation: sdkmetric.AggregationExplicitBucketHistogram{
Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000},
}},
)),
Expand Down

0 comments on commit 94a13c5

Please sign in to comment.