feat(stats)!: implement additional metric tags in libdd-trace-stats - #2170
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: b6ac861 | Docs | Datadog PR Page | Give us feedback! |
c020593 to
82959f7
Compare
82959f7 to
9977516
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
fb6b20d to
b3d13e5
Compare
# What does this PR do? - Update protobufs to be in sync with datadog-agent * `containerDebug` * `additional_metric_tags` - Update `DATADOG_AGENT_TAG` for protobufs comparison to DataDog/datadog-agent@fdc29d4 # Motivation Out of sync protobufs with datadog-agent. Needed for #2170. # Additional Notes <img width="788" height="301" alt="Screenshot 2026-06-29 at 3 03 21 PM" src="https://github.com/user-attachments/assets/ac605731-2338-4919-a078-1cb31de9b2d0" /> # How to test the change? - Weekly test to compare protobufs to main: https://github.com/DataDog/libdatadog/actions/workflows/weekly-verify-proto-files.yml - Per PR test to compare protobugs to specified commit: https://github.com/DataDog/libdatadog/actions/workflows/verify-proto-files.yml Co-authored-by: duncan.harvey <duncan.harvey@datadoghq.com>
b3d13e5 to
def0a56
Compare
def0a56 to
42e3296
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42e3296aa3
ℹ️ 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".
42e3296 to
a7a73a5
Compare
# What does this PR do? - Update protobufs to be in sync with datadog-agent * `containerDebug` * `additional_metric_tags` - Update `DATADOG_AGENT_TAG` for protobufs comparison to DataDog/datadog-agent@fdc29d4 # Motivation Out of sync protobufs with datadog-agent. Needed for #2170. # Additional Notes <img width="788" height="301" alt="Screenshot 2026-06-29 at 3 03 21 PM" src="https://github.com/user-attachments/assets/ac605731-2338-4919-a078-1cb31de9b2d0" /> # How to test the change? - Weekly test to compare protobufs to main: https://github.com/DataDog/libdatadog/actions/workflows/weekly-verify-proto-files.yml - Per PR test to compare protobugs to specified commit: https://github.com/DataDog/libdatadog/actions/workflows/verify-proto-files.yml Co-authored-by: duncan.harvey <duncan.harvey@datadoghq.com> Signed-off-by: Taegyun Kim <taegyun.kim@datadoghq.com>
a7a73a5 to
143f090
Compare
BenchmarksComparisonBenchmark execution time: 2026-07-21 19:14:13 Comparing candidate commit b6ac861 in PR branch Found 16 performance improvements and 6 performance regressions! Performance is the same for 119 metrics, 0 unstable metrics.
|
| #[test] | ||
| fn test_additional_metric_tag_value_multibyte_over_length_cap_substitutes_blocked_value() { | ||
| // 201 two-byte characters exceeds the 200-character cap even though earlier bytes-based | ||
| // checks would have let a 201-char, sub-200-byte value like this through incorrectly. |
There was a problem hiding this comment.
Nit: This comment is confusing, it seems to be referring to a test that was removed.
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
The expected merge time in
|
…n metric (#2264) ## What does this PR do? #2170 added `additional_metric_tags` to `ClientGroupedStats` in `libdd-trace-stats`, letting tracers attach extra tracer/customer-configured key/value dimensions (up to 4 keys, values capped at 200 chars) to stats aggregation. That change only wired the tags into the native `/v0.6/stats` agent payload. This PR extends the OTLP stats path (`libdd-data-pipeline/src/otlp/metrics.rs`) so the same `additional_metric_tags` are also serialized as data-point attributes on the `traces.span.sdk.metrics.duration` OTLP histogram metric, mirroring the existing `peer_tags` handling. ## Motivation Consumers of the OTLP metrics export (e.g. via an OTel collector) were silently missing these additional tags/dimensions that are already present in the native stats payload, creating a parity gap between the two export paths. ## Additional Notes - These tags are user/tracer-defined (not Datadog-internal), so — like `peer_tags` — they are emitted in both normal and `otel_trace_semantics_enabled` (OTel-semantics) mode; they're not stripped like `datadog.*` attributes. - `additional_metric_tags` entries are `"key:value"` strings; splitting on the first `:` (not `split(':')`/last) correctly preserves values containing embedded colons (e.g. URLs), matching how `peer_tags` are handled. ## How to test the change? - Added `emits_additional_metric_tags_as_attributes` unit test in `libdd-data-pipeline/src/otlp/metrics.rs` covering: normal emission, values containing embedded colons, pass-through under `otel_trace_semantics_enabled`, and skipping malformed/empty-value entries. - `cargo nextest run -p libdd-data-pipeline` and `cargo +stable clippy -p libdd-data-pipeline --all-targets -- -D warnings` pass locally. Co-authored-by: munir.abdinur <munir.abdinur@datadoghq.com>
…er-flare (#2332) # Release proposal for libdd-ffe, libdd-http-client, libdd-tracer-flare and their dependencies This PR contains version bumps based on public API changes and commits since last release. ## libdd-capabilities **Next version:** `3.0.0` **Semver bump:** `major` **Tag:** `libdd-capabilities-v3.0.0` ### Commits - fix(telemetry)!: stop sending Connection: close to the Agent (#2286) - feat(capabilities)!: Add streaming to http capabilities (#2251) - feat: added file capability [APMSP-3780] (#2240) - feat: added environment capability [APMSP-3780] (#2239) ## libdd-common **Next version:** `5.1.1` **Semver bump:** `patch` **Tag:** `libdd-common-v5.1.1` ### Commits - feat(telemetry)!: Add Installation signature and AppProduct changes payloads (#2213) - refactor: migrate to workspace dependencies, phase 4 (#2296) - refactor: migrate to workspace dependencies, phase 3 (#2283) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) - test: stabilize flaky tests (#2256) - fix(sidecar): don't double-encode file:// telemetry endpoints (#2230) - fix: last new clippy lint (#2221) ## libdd-tinybytes **Next version:** `1.1.2` **Semver bump:** `patch` **Tag:** `libdd-tinybytes-v1.1.2` ### Commits - chore: moving to workspace-level dependencies, phase 2 (#2270) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) ## libdd-trace-protobuf **Next version:** `4.0.1` **Semver bump:** `patch` **Tag:** `libdd-trace-protobuf-v4.0.1` ### Commits - refactor: migrate to workspace dependencies, phase 4 (#2296) - chore: moving to workspace-level dependencies, phase 2 (#2270) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) - feat(stats)!: implement additional metric tags in libdd-trace-stats (#2170) ## libdd-capabilities-impl **Next version:** `4.0.0` **Semver bump:** `major` **Tag:** `libdd-capabilities-impl-v4.0.0` ###⚠️ major bump forced due to: - `libdd-capabilities`: ^2.1.0 → ^3.0.0 ### Commits - feat(telemetry)!: Add Installation signature and AppProduct changes payloads (#2213) - refactor: migrate to workspace dependencies, phase 4 (#2296) - fix(telemetry)!: stop sending Connection: close to the Agent (#2286) - fix(remote-config)!: Expose HttpClientCapability in remote config (#2252) - feat(capabilities)!: Add streaming to http capabilities (#2251) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) - feat: added file capability [APMSP-3780] (#2240) - feat(telemetry)!: make telemetry worker wasm-compatible for the TraceExporter (#2172) - feat: added environment capability [APMSP-3780] (#2239) ## libdd-http-client **Next version:** `1.0.0` **Semver bump:** `major` **Tag:** `libdd-http-client-v1.0.0` **Warning:** this is an initial release. Please verify that the version and commits included are correct. ## libdd-trace-normalization **Next version:** `3.0.1` **Semver bump:** `patch` **Tag:** `libdd-trace-normalization-v3.0.1` ### Commits - refactor: migrate to workspace dependencies, phase 4 (#2296) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) ## libdd-remote-config **Next version:** `3.0.0` **Semver bump:** `major` **Tag:** `libdd-remote-config-v3.0.0` ### Commits - refactor(rc)!: make conversion from RemoteConfigProduct back and forth generally available (#2325) - fix(wasm)!: finish the WASM port of remote-config (#2315) - refactor: migrate to workspace dependencies, phase 3 (#2283) - feat(rc): Handle expired config status (#2274) - feat(remote-config)!: add AsmRawResponseBody capability (#2278) - chore: moving to workspace-level dependencies, phase 2 (#2270) - fix(remote-config)!: Expose HttpClientCapability in remote config (#2252) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) - fix(rc): Make Target fields available again after eaf5ad0 (#2232) - fix: new clippy lints (#2219) ## libdd-trace-utils **Next version:** `10.0.0` **Semver bump:** `major` **Tag:** `libdd-trace-utils-v10.0.0` ###⚠️ major bump forced due to: - `libdd-capabilities`: ^2.1.0 → ^3.0.0 ### Commits - refactor(rc)!: make conversion from RemoteConfigProduct back and forth generally available (#2325) - fix(libdd-trace-utils): apply SpanLink flags masking when v0.5 json encoding (#2314) - refactor: migrate to workspace dependencies, phase 4 (#2296) - feat(data-pipeline)!: add compression option for agentless export (#2205) - refactor: migrate to workspace dependencies, phase 3 (#2283) - refactor(trace-utils)!: split generic TracerHeaderTags (#2279) - chore(lint): update nightly (#2281) - chore: moving to workspace-level dependencies, phase 2 (#2270) - fix(remote-config)!: Expose HttpClientCapability in remote config (#2252) - refactor: consolidate core dependencies at workspace level (phase 1) (#2253) - feat(stats)!: implement additional metric tags in libdd-trace-stats (#2170) - feat(trace-utils)!: add v1 decoder (#2174) - feat(trace-utils)!: add encoder v1 to v04 + refactor (#2145) - feat(otlp): add instrumentation scope metadata (#2235) - fix(trace-utils)!: serialize v0.5 span links and events into meta (#980) ## libdd-ffe **Next version:** `1.0.0` **Semver bump:** `major` **Tag:** `libdd-ffe-v1.0.0` **Warning:** this is an initial release. Please verify that the version and commits included are correct. ## libdd-tracer-flare **Next version:** `1.0.0` **Semver bump:** `major` **Tag:** `libdd-tracer-flare-v1.0.0` **Warning:** this is an initial release. Please verify that the version and commits included are correct. [APMSP-3780]: https://datadoghq.atlassian.net/browse/APMSP-3780?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [APMSP-3780]: https://datadoghq.atlassian.net/browse/APMSP-3780?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [APMSP-3780]: https://datadoghq.atlassian.net/browse/APMSP-3780?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: hoolioh <107922352+hoolioh@users.noreply.github.com>
What does this PR do?
ClientGroupedStats.additional_metric_tags.additional_metric_tagsto 4, not configurable.tracer_blocked_value.Motivation
Additional Notes
Additional metric tags still need to be implemented in libdd-data-pipeline. Omitted from this PR since the goal of this PR is to support additional metric tags tags for Serverless without affecting other teams.
libdatadog/libdd-data-pipeline/src/trace_exporter/stats.rs
Line 146 in 42e3296
Per-field cardinality limit for additional metric tags will be implemented in a following PR, #2211.
additional_metric_tags_max_entries. Once exceeded, new entries have their tag values masked totracer_blocked_value.Implementing additional metric tags instead of span derived primary tags. See previous PR for span derived primary tags - #1815.
How to test the change?
DD_TAGS: custom.primary:val,workload:azure_functionsDD_TRACE_EXPERIMENTAL_FEATURES_ENABLED: trueDD_TRACE_STATS_ADDITIONAL_TAGS: custom.primary,workload