Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OTEL dependencies to latest release candidates #620

Merged
merged 5 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion exporter/collector/integrationtest/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package integrationtest

import (
"context"
"fmt"
"sort"
"testing"
"time"
Expand Down Expand Up @@ -203,10 +204,11 @@ func TestSDKMetrics(t *testing.T) {
expectFixture,
)
if diff != "" {
fmt.Printf("%s", diff)
require.Fail(
t,
"Expected requests fixture and actual GCM requests differ",
diff,
"",
damemi marked this conversation as resolved.
Show resolved Hide resolved
)
}
})
Expand Down
15 changes: 12 additions & 3 deletions exporter/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,26 @@
ts.Metric = me.recordToMpb(m, point.Attributes, library, extraLabels)
tss = append(tss, ts)
}
case metricdata.Histogram[float64]:
case metricdata.Histogram[int64]:
for _, point := range a.DataPoints {
ts, err := histogramToTimeSeries(point, m, mr)
if err != nil {
aggErr = multierr.Append(aggErr, err)
continue

Check warning on line 498 in exporter/metric/metric.go

View check run for this annotation

Codecov / codecov/patch

exporter/metric/metric.go#L497-L498

Added lines #L497 - L498 were not covered by tests
}
ts.Metric = me.recordToMpb(m, point.Attributes, library, extraLabels)
tss = append(tss, ts)
}
case metricdata.Histogram[float64]:
damemi marked this conversation as resolved.
Show resolved Hide resolved
for _, point := range a.DataPoints {
ts, err := histogramToTimeSeries(point, m, mr)
if err != nil {
aggErr = multierr.Append(aggErr, err)
continue
}
ts.Metric = me.recordToMpb(m, point.Attributes, library, extraLabels)
tss = append(tss, ts)
}
default:
aggErr = multierr.Append(aggErr, errUnexpectedAggregationKind{kind: reflect.TypeOf(m.Data).String()})
}
Expand Down Expand Up @@ -616,9 +625,9 @@
for i, v := range hist.BucketCounts {
counts[i] = int64(v)
lrascao marked this conversation as resolved.
Show resolved Hide resolved
}
var mean N
var mean float64
if !math.IsNaN(float64(hist.Sum)) && hist.Count > 0 { // Avoid divide-by-zero
mean = hist.Sum / N(hist.Count)
mean = float64(hist.Sum) / float64(hist.Count)
}
return &monitoringpb.TypedValue{
Value: &monitoringpb.TypedValue_DistributionValue{
Expand Down