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

Metrics: Using View to change aggregation causes an abort during export #2466

Closed
duncanpo opened this issue Dec 21, 2023 · 2 comments · Fixed by #2467
Closed

Metrics: Using View to change aggregation causes an abort during export #2466

duncanpo opened this issue Dec 21, 2023 · 2 comments · Fixed by #2467
Assignees
Labels
bug Something isn't working

Comments

@duncanpo
Copy link

Describe your environment
I am using Windows and building with Visual Studio 2019

Steps to reproduce
This issue can be reproduced by making some small changes to the "otlp" example. Replace the InitMetrics function in examples/otlp/http_metric_main.cc with this version that attaches a View to the MeterProvider to change the aggregation of a counter to "LastValue". I have attached the modified file as a .txt. Build the example and run.

What is the expected behavior?
I am expecting to see the latest recorded values in the collector.

What is the actual behavior?
I am encountering an "Abort".

http_metric_main.cc.txt

@duncanpo duncanpo added the bug Something isn't working label Dec 21, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 21, 2023
@duncanpo
Copy link
Author

I looked into the code and the problem seems to be in the otlp exporter. In the method OtlpMetricUtils::GetAggregationType in exporters/otlp/src/otlp_metric_utils.cc, it uses InstrumentType to determine aggregation type, which doesn't take into account any modifications from View.

@lalitb
Copy link
Member

lalitb commented Dec 21, 2023

Thank you for providing clear and sufficient information about the issue, which helped in troubleshooting. Have implemented a solution in pull request #2467, which you can test if you'd like.

@lalitb lalitb self-assigned this Dec 21, 2023
@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants