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

OTLP Exporter does not set an observable counter as monotonic #2469

Closed
samin36 opened this issue Dec 21, 2023 · 2 comments · Fixed by #2478
Closed

OTLP Exporter does not set an observable counter as monotonic #2469

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

Comments

@samin36
Copy link
Contributor

samin36 commented Dec 21, 2023

Recently upgraded to Opentelemetry-cpp v1.12.0 and noticed some difference in how the OTLP Exporter exports Counters/UpDownCounters. In the previous version (v1.9.0) I was using, all observable Counters/UpDownCounters were exported with the is_monotonic flag set to true. As a result, the Prometheus exporter in the Opentelemetry Collector Contrib mapped the OTEL Counters/UpDownCounters to Prometheus Counters. Issue #2170 changed the behavior to only set the monotonic flag for kCounter. As a result, in v1.12.0, only the synchronous Counter is mapped to the Prometheus Counter type by the Collector; synchronous UpDownCounter and observable Counter/UpDownCounters are mapped to Prometheus Gauge type.

My question is, shouldn't observable Counters be mapped to Prometheus Counter type? For that to happen, we would need to set the is_monotonic flag for both kCounter and kObservableCounter. According to the official spec, if the aggregation temporality is cumulative and the sum is monotonic, it MUST be converted to a Prometheus Counter.

Also, for reference, seems like the Python SDK exports observable Counters with the is_monotonic flag set as the Prometheus endpoint shows the instrument type as a Counter instead of a Gauge.

@samin36 samin36 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
@lalitb
Copy link
Member

lalitb commented Jan 4, 2024

@samin36 your analysis is correct. Both Counter and ObservableCounter should have the is_monotonic flag as true. Do you want to raise a PR for the fix?

@samin36
Copy link
Contributor Author

samin36 commented Jan 4, 2024

Thank you for confirming, and sure, will raise a PR soon.

@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 8, 2024
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