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

translate IntHistogram to Histogram in otlp_wrappers #3613

Merged

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Jul 13, 2021

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 into Histogram. 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 and IntHistogram are valid Histogram after translation.

@codeboten codeboten requested a review from a team as a code owner July 13, 2021 21:58
@codeboten codeboten requested a review from jrcamp July 13, 2021 21:58
@project-bot project-bot bot added this to In progress in Collector Jul 13, 2021
Comment on lines 50 to 52
Value: &otlpmetrics.Exemplar_AsDouble{
AsDouble: float64(exemplar.Value),
},
Copy link
Member

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?

Copy link
Contributor Author

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.

@@ -38,6 +39,58 @@ func MetricsFromOtlp(req *otlpcollectormetrics.ExportMetricsServiceRequest) Metr
return MetricsWrapper{req: req}
}

func intHistogramToHistogram(src *otlpmetrics.Metric_IntHistogram) *otlpmetrics.Metric_Histogram {
Copy link
Member

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 :)

Copy link
Contributor Author

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.

@codeboten codeboten force-pushed the codeboten/deprecate-int-histogram branch from 9accefa to 83e3c76 Compare July 14, 2021 17:18
Collector automation moved this from In progress to Reviewer approved Jul 14, 2021
@bogdandrutu bogdandrutu merged commit 7e7ee8f into open-telemetry:main Jul 14, 2021
Collector automation moved this from Reviewer approved to Done Jul 14, 2021
@codeboten codeboten mentioned this pull request Jul 19, 2021
@codeboten codeboten deleted the codeboten/deprecate-int-histogram branch June 22, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Collector
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants