feat(otlp): added support for datadog_metric.as_type=rate for sums - #2201
feat(otlp): added support for datadog_metric.as_type=rate for sums#2201lucastemb wants to merge 4 commits into
Conversation
Binary Size Analysis (Agent Data Plane)Baseline: 36f7279 · Comparison: 5636c9e · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
There was a problem hiding this comment.
The new as_type=rate path constructs every converted delta Sum with a zero interval. Both Datadog encoders divide the value by that interval and discard the resulting non-finite value, so a valid delta Sum such as 42 is sent as a rate series with no points and is silently lost.
📊 Validated against 1 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit 94add5d · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
| let values = match data_type { | ||
| DataType::Gauge => MetricValues::gauge((timestamp_s, value)), | ||
| DataType::Count => MetricValues::counter((timestamp_s, value)), | ||
| DataType::Rate => MetricValues::rate((timestamp_s, value), Duration::ZERO), |
There was a problem hiding this comment.
Zero rate interval drops converted delta Sums
All default-config delta Sums requesting as_type=rate are silently omitted from Datadog metric payloads, causing users to lose those measurements.
Assertion details
- Input: An OTLP delta Sum with
datadog.metric.as_type=rateand value 42, when interval inference is unavailable (the default configuration). - Expected:
The converted metric should preserve the value in an encodable rate representation, or use a defined fallback that does not discard the point. - Actual: The diff creates
MetricValues::Rate(..., Duration::ZERO). The v1 and v2 encoders divide the value byinterval.as_secs_f64(), producing infinity, and their non-finite filter removes the point; the payload retains rate type and interval 0 but has no points.
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
There was a problem hiding this comment.
Same rationale as below.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94add5d755
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let values = match data_type { | ||
| DataType::Gauge => MetricValues::gauge((timestamp_s, value)), | ||
| DataType::Count => MetricValues::counter((timestamp_s, value)), | ||
| DataType::Rate => MetricValues::rate((timestamp_s, value), Duration::ZERO), |
There was a problem hiding this comment.
Avoid zero-interval rate metrics
For any OTLP delta Sum datapoint with datadog.metric.as_type=rate, this creates a MetricValues::Rate with Duration::ZERO; I checked the Datadog metrics encoders and they divide rate values by the stored interval before filtering finite points, so every finite value becomes inf/NaN and is dropped from the payload instead of being emitted as a rate. Use the inferred delta interval when available, and a non-zero/no-scale representation for the no-interval case.
Useful? React with 👍 / 👎.
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (3)Experiments configured
Bounds Checks: ✅ Passed (3)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
Summary
When a metric is emitted with the attribute
as_type=rate, we should strive to emit delta Sums as aRate.as_type=ratewill be treated as case insensitiveAdditional plumbing is added to make additional metric types such as
CountandGaugeno-ops while making unknown types emit an error.Lastly, after investigating #2076, we discovered that
with_delta_intervalsits behind a feature gate with the defaultfalsewith no way to toggle it totrue, meaning, that the duration will stay zero since we have no way to compute the interval.Consequently, we will emit a warning the first time that a metric is observed notifying no delta interval is available.
Change Type
How did you test this PR?
Unit tests.
References