-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
translate IntHistogram to Histogram in otlp_wrappers #3613
translate IntHistogram to Histogram in otlp_wrappers #3613
Conversation
model/internal/otlp_wrapper.go
Outdated
Value: &otlpmetrics.Exemplar_AsDouble{ | ||
AsDouble: float64(exemplar.Value), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be AsInt correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I misinterpreted the comment in the proto about values being translated to float from int64 to include the values of the Exemplar.
model/internal/otlp_wrapper.go
Outdated
@@ -38,6 +39,58 @@ func MetricsFromOtlp(req *otlpcollectormetrics.ExportMetricsServiceRequest) Metr | |||
return MetricsWrapper{req: req} | |||
} | |||
|
|||
func intHistogramToHistogram(src *otlpmetrics.Metric_IntHistogram) *otlpmetrics.Metric_Histogram { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: usually I prefer public funcs at the top :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this function to the bottom.
9accefa
to
83e3c76
Compare
Description:
Deprecating IntHistogram. As per https://github.com/open-telemetry/opentelemetry-proto/blob/f3b0ee0861d304f8f3126686ba9b01c106069cb0/opentelemetry/proto/metrics/v1/metrics.proto#L170, the OTLP receiver will translate
IntHistogram
intoHistogram
. Would love any pointers on how to improve the tests here, are there are utilities I've not used in the collector codebase to make the test less manual?Link to tracking Issue: Part of #3534
Testing: Added a test to ensure both
Histogram
andIntHistogram
are validHistogram
after translation.