fix(metrics): encode units in V3 series payloads#1761
Conversation
There was a problem hiding this comment.
Pull request overview
Adds metric unit encoding to V3 series payloads, matching the Datadog Agent V3 serializer. Units are interned into a new dictionary and stored sparsely via a per-metric FLAG_HAS_UNIT bit and a parallel unit_refs column. Sketches deliberately do not encode units, mirroring Agent behavior.
Changes:
- Introduces
FLAG_HAS_UNIT, a unit interner, dictionary bytes, and sparseunit_refscolumn inV3Writer, plus aV3MetricBuilder::set_unitAPI. - Adds
DICT_UNIT_STR_FIELD_NUMBER(25) andUNIT_REFS_FIELD_NUMBER(26) constants and serializes the new fields infinalize. - Wires
metric.metadata().unit()into the V3 writer for non-sketch metrics and adds unit tests + payload-level integration tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/saluki-components/src/encoders/datadog/metrics/v3/constants.rs | Adds new V3 protobuf field numbers for unit dictionary and unit refs. |
| lib/saluki-components/src/encoders/datadog/metrics/v3/writer.rs | Implements sparse unit interning, encoding, delta-encoding, and serialization with new set_unit builder API and tests. |
| lib/saluki-components/src/encoders/datadog/metrics/mod.rs | Sets units on V3 builder for non-sketch metrics; adds payload-level tests verifying sparse unit refs and sketch exclusion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Binary Size Analysis (Agent Data Plane)Baseline: 1ad7cde · Comparison: 935bba5 · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
|
/merge |
|
View all feedbacks in Devflow UI.
Progress updates will be sent here directly.
merge method 'merge' is not allowed for this repository. Supported methods are: [squash, rebase] |
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (35)Experiments configured
Bounds Checks: ✅ Passed (5)
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 ( |
a2ca1c3
into
tobz/datadog-metrics-v3-payload-support
Summary
This pr adds metric units encoding into V3 series payloads to match the Datadog Agent V3 serializer.
This change keeps sketch behavior unchanged: V3 sketches do not encode units, matching the Agent
sketch path.
Change Type
How did you test this PR?
unit tests / ci
References