Skip to content

signaltometricsconnector: Add sum.monotonic property for improved counter handling#45865

Merged
mx-psi merged 6 commits into
open-telemetry:mainfrom
bencehornak:signaltometrics-sum-monotonic
Mar 10, 2026
Merged

signaltometricsconnector: Add sum.monotonic property for improved counter handling#45865
mx-psi merged 6 commits into
open-telemetry:mainfrom
bencehornak:signaltometrics-sum-monotonic

Conversation

@bencehornak

Copy link
Copy Markdown
Contributor

Description

So far there has been no way to set the IsMonotonic property of metrics, although the main use-case based on the examples of the README is to generate counters, which are clearly monotonic.

The incorrect monotonic=false setting causes some problems on my end, namely that the OTel -> Prometheus conversion is incorrect (_total isn't appended, if monotonic is false), additionally, the interval processor doesn't work with non-monotonic sums.

@github-actions

Copy link
Copy Markdown
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added the Stale label Feb 22, 2026
@bencehornak

Copy link
Copy Markdown
Contributor Author

Waiting for the review of @ChrsMark and @lahsivjar

@bencehornak bencehornak force-pushed the signaltometrics-sum-monotonic branch from 14c6393 to e8ac38e Compare February 22, 2026 07:41
Signed-off-by: Bence Hornák <bence.hornak@gmail.com>
Signed-off-by: Bence Hornák <bence.hornak@gmail.com>
Signed-off-by: Bence Hornák <bence.hornak@gmail.com>
Signed-off-by: Bence Hornák <bence.hornak@gmail.com>
Signed-off-by: Bence Hornák <bence.hornak@gmail.com>
@bencehornak bencehornak force-pushed the signaltometrics-sum-monotonic branch from e8ac38e to 5bda2a7 Compare February 22, 2026 07:52
@github-actions github-actions Bot removed the Stale label Feb 23, 2026

@lahsivjar lahsivjar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies about the delay in the review. Mostly LGTM, just a comment on one of the test value change.

startTimeUnixNano: "1581452772000000321"
timeUnixNano: "1581452773000000789"
- asInt: "456"
- asInt: "-456"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this break some other tests too? What's the rationale for this change of test value?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what is happening now, this specific test data was only used for counting. LGTM!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to make this test a generic 'sum' test case without specifying is_monotonic explicitly.

- name: non.monotonic.sum
description: A non-monotonic sum
conditions:
- metric.name == "sum-int"
sum:
value: datapoint.value_int
# monotonic: false by default

So I wanted to make sure that we are not testing only a 'special' case, in which all increments are positive, and the metric can go only up.

@lahsivjar lahsivjar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

startTimeUnixNano: "1581452772000000321"
timeUnixNano: "1581452773000000789"
- asInt: "456"
- asInt: "-456"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what is happening now, this specific test data was only used for counting. LGTM!

@lahsivjar

Copy link
Copy Markdown
Member

@mx-psi I think this PR is ready to be merged, or is there anything else we are waiting on?

@mx-psi mx-psi merged commit 1acadac into open-telemetry:main Mar 10, 2026
190 of 191 checks passed
@otelbot

otelbot Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @bencehornak! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants