Modify Prometheus exporter to translate non-monotonic Sums into gauges#3306
Merged
ocelotl merged 16 commits intoopen-telemetry:mainfrom Aug 7, 2023
Merged
Conversation
4777f46 to
01fc016
Compare
This was referenced May 10, 2023
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
srikanthccv
reviewed
Jun 1, 2023
exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py
Outdated
Show resolved
Hide resolved
Contributor
Author
|
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!! |
srikanthccv
approved these changes
Jun 13, 2023
exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py
Outdated
Show resolved
Hide resolved
Contributor
Author
|
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) |
Member
|
@brettimus looks like there are build failures, could you take a look? |
Contributor
Author
|
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! |
Contributor
Author
Contributor
Author
|
heck yeah! all green 🟢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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-prometheustox -e lintDoes 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/utilhave 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.tomlisort.cfg.flake8When a new
.github/CODEOWNERis addedMajor changes to project information, such as in:
README.mdCONTRIBUTING.mdYes. - Link to PR:
No.
Checklist: