-
Notifications
You must be signed in to change notification settings - Fork 650
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
Modify Prometheus exporter to translate non-monotonic Sums into gauges #3306
Modify Prometheus exporter to translate non-monotonic Sums into gauges #3306
Conversation
4777f46
to
01fc016
Compare
Add unit tests for translating monotonic and non-monotonic Sums to prometheus metrics Update prometheus metric translation to match spec Added a check for the aggregation temporality of a Sum. "If the aggregation temporality is cumulative and the sum is non-monotonic, it MUST be converted to a Prometheus Gauge." Update changelog
01fc016
to
ca4eb1f
Compare
64110c1
to
0ceeea2
Compare
exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py
Outdated
Show resolved
Hide resolved
hey all! would it be possible to approve and/or merge this before the next release? i contribute to an open source lib that would benefit from this fix thank you!! |
exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py
Outdated
Show resolved
Hide resolved
hi there! the only issue in the last run of the workflows had to do with linting afaik. i just ran (sorry for that hiccup by the way) |
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.
Thanks for the PR, lgtm
@brettimus looks like there are build failures, could you take a look? |
looks like i needed to update my new test after #3279 was merged everything is green again locally! though i'm sad i didn't get to this sooner. i missed the release by a day! |
heck yeah! all green 🟢 |
Description
This PR modifies the prometheus exporter code that translates OpenTelemetry metrics into Prometheus metrics.
Prometheus has the concept of a Gauge, which is effectively a non-monotonic Sum. (In the world of Prometheus, a monotonic Sum is called a Counter.)
At present, the code that translates OTEL metrics into Prometheus metrics currently treats all Sums as Prometheus "Counters", regardless of their monotonicity.
Quoting @dashpole in issue #3071
Therefore, I've modified the Prometheus exporter to always convert non-monotonic Sums (with cumulative aggregation temporality) into Prometheus Gauges.
Fixes #3071
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
tox -e opentelemetry-exporter-prometheus
tox -e lint
Does This PR Require a Contrib Repo Change?
Answer the following question based on these examples of changes that would require a Contrib Repo Change:
The OTel specification has changed which prompted this PR to update the method interfaces of
opentelemetry-api/
oropentelemetry-sdk/
The method interfaces of
test/util
have changedScripts in
scripts/
that were copied over to the Contrib repo have changedConfiguration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in
pyproject.toml
isort.cfg
.flake8
When a new
.github/CODEOWNER
is addedMajor changes to project information, such as in:
README.md
CONTRIBUTING.md
Yes. - Link to PR:
No.
Checklist: