From 4d24d5a7d75136be3af54b59c2cbada9f26d6cfe Mon Sep 17 00:00:00 2001 From: dmathieu Date: Thu, 27 Apr 2023 12:28:48 +0200 Subject: [PATCH] histogram is not a generic type in 0.37 --- module/apmotel/gatherer.go | 6 ++---- module/apmotel/gatherer_test.go | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/module/apmotel/gatherer.go b/module/apmotel/gatherer.go index 52df10e80..275696ad1 100644 --- a/module/apmotel/gatherer.go +++ b/module/apmotel/gatherer.go @@ -60,9 +60,7 @@ func (e Gatherer) GatherMetrics(ctx context.Context, out *apm.Metrics) error { for _, sm := range scopeMetrics.Metrics { switch m := sm.Data.(type) { - case metricdata.Histogram[int64]: - addHistogramMetric(out, sm, m) - case metricdata.Histogram[float64]: + case metricdata.Histogram: addHistogramMetric(out, sm, m) case metricdata.Sum[int64]: for _, dp := range m.DataPoints { @@ -89,7 +87,7 @@ func (e Gatherer) GatherMetrics(ctx context.Context, out *apm.Metrics) error { return nil } -func addHistogramMetric[N int64 | float64](out *apm.Metrics, sm metricdata.Metrics, m metricdata.Histogram[N]) { +func addHistogramMetric(out *apm.Metrics, sm metricdata.Metrics, m metricdata.Histogram) { for _, dp := range m.DataPoints { if len(dp.BucketCounts) != len(dp.Bounds)+1 || len(dp.Bounds) == 0 { continue diff --git a/module/apmotel/gatherer_test.go b/module/apmotel/gatherer_test.go index 8f78a904d..6b9bec0c0 100644 --- a/module/apmotel/gatherer_test.go +++ b/module/apmotel/gatherer_test.go @@ -28,7 +28,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" - metric "go.opentelemetry.io/otel/metric/global" + metric "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation"