Skip to content

feat: implement additional metric tags for trace stats#140

Open
duncanpharvey wants to merge 7 commits into
mainfrom
duncan-harvey/trace-stats-additional-metric-tags
Open

feat: implement additional metric tags for trace stats#140
duncanpharvey wants to merge 7 commits into
mainfrom
duncan-harvey/trace-stats-additional-metric-tags

Conversation

@duncanpharvey

@duncanpharvey duncanpharvey commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

  • Add DD_TRACE_STATS_ADDITIONAL_TAGS setting for adding additional tags to trace stats.
  • Add DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT to limit number of distinct stats entries (default of 100 in libdd-trace-stats if no value is passed).
  • Add DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED to gate the behavior behind DD_TRACE_STATS_ADDITIONAL_TAGS and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT.

Motivation

Allow Serverless Compatibility Layer to send additional metric tags on trace stats. See RFC.

https://datadoghq.atlassian.net/browse/SVLS-8787

Additional Notes

Dependent on these changes in libdatadog: DataDog/libdatadog#2170

Describe how to test/QA your changes

  • Unit tests for regressions and new functionality added by DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED
  • Deploy to Azure Functions with the following environment variables and validate that additional tags appear on trace metrics
    • DD_TAGS: custom.primary:val,workload:azure_functions
    • DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED: true
    • DD_TRACE_STATS_ADDITIONAL_TAGS: custom.primary,workload
Screenshot 2026-07-06 at 3 39 47 PM

@duncanpharvey duncanpharvey force-pushed the duncan-harvey/trace-stats-additional-metric-tags branch from 6fae257 to e38ada5 Compare June 29, 2026 14:11
@datadog-datadog-prod-us1-2

This comment has been minimized.

@duncanpharvey duncanpharvey changed the title feat: implement implement additional metric tags for trace stats feat: implement additional metric tags for trace stats Jun 29, 2026
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/trace-stats-additional-metric-tags branch from e38ada5 to ec966d8 Compare June 29, 2026 16:05
@duncanpharvey duncanpharvey force-pushed the duncan-harvey/trace-stats-additional-metric-tags branch from ec966d8 to 9ed7705 Compare July 6, 2026 17:02
@duncanpharvey duncanpharvey marked this pull request as ready for review July 6, 2026 20:08
@duncanpharvey duncanpharvey requested a review from a team as a code owner July 6, 2026 20:08
Copilot AI review requested due to automatic review settings July 6, 2026 20:08
@duncanpharvey duncanpharvey requested a review from a team as a code owner July 6, 2026 20:08
@duncanpharvey duncanpharvey requested review from Lewis-E and jchrostek-dd and removed request for a team July 6, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements support for sending additional metric tags on trace stats by introducing new configuration settings (gated behind an experimental flag) and wiring them into the trace stats concentrator, along with updating the libdatadog dependency revision required for the feature.

Changes:

  • Add DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS, and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT parsing to trace-agent config (with unit tests for gating).
  • Update stats concentrator creation to pass additional metric tags + optional cardinality limit, and introduce a hashable key wrapper for TracerMetadata.
  • Bump libdatadog git revs across crates and update lockfile / third-party license list accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
LICENSE-3rdparty.csv Adds newly introduced transitive dependencies to the third-party license inventory.
crates/datadog-trace-agent/src/trace_processor.rs Updates tests/struct construction to include newly added config fields and payload field.
crates/datadog-trace-agent/src/stats_concentrator_service.rs Passes additional metric tags + cardinality limit into SpanConcentrator and updates metadata keying.
crates/datadog-trace-agent/src/config.rs Adds experimental flag + additional tag settings, with unit tests for gating behavior.
crates/datadog-trace-agent/Cargo.toml Bumps libdatadog git revision to pick up required upstream changes.
crates/datadog-serverless-compat/Cargo.toml Bumps libdatadog git revision for trace utils.
crates/datadog-metrics-collector/Cargo.toml Bumps libdatadog git revision for common utilities.
crates/datadog-agent-config/Cargo.toml Bumps libdatadog git revision for trace utils/obfuscation.
Cargo.lock Locks new upstream libdatadog revisions and new transitive crates introduced by the update.

Comment thread crates/datadog-trace-agent/src/config.rs
Comment thread crates/datadog-trace-agent/src/config.rs Outdated
Comment thread LICENSE-3rdparty.csv
Comment thread crates/datadog-trace-agent/src/stats_concentrator_service.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants