Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

[OTEL-2697][pkg/otlp/metrics] Add WithInferDeltaInterval option#765

Merged
mx-psi merged 5 commits into
mainfrom
mx-psi/infer-interval
Aug 19, 2025
Merged

[OTEL-2697][pkg/otlp/metrics] Add WithInferDeltaInterval option#765
mx-psi merged 5 commits into
mainfrom
mx-psi/infer-interval

Conversation

@mx-psi
Copy link
Copy Markdown
Member

@mx-psi mx-psi commented Aug 19, 2025

What does this PR do?

Adds option to infer interval field. This only works for delta sums that have a startTimestamp set. We set the interval if and only if it is 'close' (within the tolerance, fixed to 0.1 seconds) to a whole number of seconds (since the Datadog API only supports a whole number of seconds as an interval). The tolerance accounts for jitter. The solution should be robust against network errors.

Motivation

While ultimately we can only set the interval for users in a subset of cases, we can do so in this case reasonably well

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.33%. Comparing base (86d859b) to head (3b6a5c2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #765      +/-   ##
==========================================
+ Coverage   81.20%   81.33%   +0.12%     
==========================================
  Files          53       53              
  Lines        4215     4244      +29     
==========================================
+ Hits         3423     3452      +29     
  Misses        688      688              
  Partials      104      104              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mx-psi mx-psi marked this pull request as ready for review August 19, 2025 10:33
@mx-psi mx-psi requested a review from a team as a code owner August 19, 2025 10:33
@mx-psi mx-psi requested a review from dineshg13 August 19, 2025 10:33
Comment thread pkg/otlp/metrics/metrics_translator.go Outdated
@mx-psi mx-psi requested a review from jade-guiton-dd August 19, 2025 12:40
Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

Small bug in the test (and weird behavior in the breaking changes check) aside, LGTM

Comment thread pkg/otlp/metrics/metrics_translator_test.go Outdated
@mx-psi mx-psi enabled auto-merge (squash) August 19, 2025 13:39
@mx-psi
Copy link
Copy Markdown
Member Author

mx-psi commented Aug 19, 2025

Small bug in the test (and weird behavior in the breaking changes check) aside, LGTM

The breaking changes check was also broken for Jasmine's PR so I think this is just a bug in this check

@mx-psi mx-psi merged commit 0a3865d into main Aug 19, 2025
6 of 7 checks passed
@mx-psi mx-psi deleted the mx-psi/infer-interval branch August 19, 2025 14:04
mx-psi added a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Sep 8, 2025
…aMetrics' feature gate (#42494)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds a new `exporter.datadogexporter.InferIntervalForDeltaMetrics`
feature gate. This feature gate will set the interval field for OTLP
delta metrics when it can be inferred (i.e. when the difference between
Timestamp and StartTimestamp is close enough to a whole number of
seconds).

Relates to
[DataDog/opentelemetry-mapping-go/pull/765](DataDog/opentelemetry-mapping-go#765)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants