Skip to content

Commit

Permalink
histogram is not a generic type in 0.37
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Apr 27, 2023
1 parent 95dc0e9 commit 4d24d5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions module/apmotel/gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion module/apmotel/gatherer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 4d24d5a

Please sign in to comment.