Skip to content

Keep DD_SPAN_TAGS when remote config overrides tracing tags - #12937

Draft
dougqh wants to merge 3 commits into
dougqh/rc-tracing-tags-testsfrom
dougqh/split-global-span-tags
Draft

dougqh wants to merge 3 commits into
dougqh/rc-tracing-tags-testsfrom
dougqh/split-global-span-tags

Conversation

@dougqh

@dougqh dougqh commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Keeps the global tags (DD_TAGS) apart from the span defaults (DD_SPAN_TAGS) in the tracer's config snapshot. Remote config tracing_tags now replaces only the global tags.

  • Dynamic config: tracingTags now holds only the global tags, seeded from Config.getGlobalTags(). The test-runner path, rebuildTraceConfig, already did this.

  • Span defaults: DD_SPAN_TAGS (new Config.getSpanTags()), or the tags given to the builder's defaultSpanTags. Remote config never replaces these.

  • ConfigSnapshot: keeps two frozen maps alongside mergedTracerTags:

    • globalTags: the global tags as given, or their RC override;
    • spanDefaultTags: the span defaults plus the tracer-defined tags (env, _dd.dsm.enabled, …).

    mergedTracerTags is built from both, with span defaults winning as before. Read-through and span semantics are unchanged.

Motivation

  1. Stop repeating global tags as OTLP span attributes #12813 (OTLP): to put DD_TAGS on the OTLP Resource without repeating them on every span, the exporter needs the global tags as their own set. Today it has to recover them by comparing values against the static Config. With this change, core can build the Resource from globalTags and write spanDefaultTags on spans, taking both from the trace's snapshot (TraceCollector.getTraceConfig()). The Resource then also follows RC tag changes. The OTLP side is a follow-up and isn't included here.
  2. RC dropped DD_SPAN_TAGS: the dynamic config held DD_TAGS + DD_SPAN_TAGS merged, so an RC tracing_tags override replaced both. The span tags disappeared until the override was removed. See Add test for remote config tracing tags overriding DD_TAGS #12936 and the comment there.

Behavior changes (release notes)

  • An RC tracing_tags override no longer drops DD_SPAN_TAGS. This matches system-tests' stated intent ("local tags are overridden" refers to DD_TAGS). Pending confirmation from @mcculls on Add test for remote config tracing tags overriding DD_TAGS #12936, so this PR stays a draft until then.
  • Builder / DDTracer defaultSpanTags: explicit defaults are now the span-defaults level.
    • They survive RC tag changes. Before, the first RC tag change silently replaced them with the config tags.
    • DD_TAGS now apply alongside them. Before, explicit defaults replaced the config tags at startup.
    • The tracer-defined tags (env, dsm/djm) are now added at startup too. Before, they were only added after an RC tag change.

Additional Notes

  • Stacked on Add test for remote config tracing tags overriding DD_TAGS #12936. Review the two commits on top: production code, then tests.
  • Cold path only: the maps are rebuilt only when a config snapshot's tracing tags change. Per-span work is unchanged.
  • Config.getGlobalTags() already includes env when DD_ENV is set, so globalTags can contain env. That's harmless for OTLP, whose Resource already ignores env among the global tags.
  • No production reader of globalTags / spanDefaultTags yet. The consumer is the Stop repeating global tags as OTLP span attributes #12813 rebuild.
  • Tests:
    • remoteConfigTracingTagsOverrideGlobalTags has its DD_SPAN_TAGS row back;
    • new configSnapshotSeparatesGlobalTagsFromSpanDefaults;
    • dd-trace-core (2,725 tests), ConfigTest and dd-trace-ot all pass locally.

Jira ticket: [PROJ-IDENT]

🤖 Generated with Claude Code

dougqh and others added 2 commits October 19, 2026 14:21
Remote config tracing_tags now replaces only the global tags (DD_TAGS).
Previously the dynamic config held DD_TAGS and DD_SPAN_TAGS merged, so an
RC tag override also dropped DD_SPAN_TAGS until it was removed.

ConfigSnapshot now keeps the global tags and the span defaults as separate
frozen TagMaps, and builds mergedTracerTags from them (span defaults win,
as before). Span defaults are DD_SPAN_TAGS, or the tags given to the
builder's defaultSpanTags, and are no longer lost on the first RC tag
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added type: bug fix Bug fix comp: core Tracer core comp: remote config Configuration at Runtime tag: ai generated Largely based on code generated by an AI or LLM labels Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 85.71%
• Overall Coverage: 59.45% (-19.66%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3d144d9 | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.99 s 13.94 s [-0.5%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.86 s 12.98 s [-1.7%; -0.2%] (maybe better)
startup:petclinic:appsec:Agent 17.14 s 16.85 s [+0.7%; +2.7%] (maybe worse)
startup:petclinic:iast:Agent 16.84 s 17.12 s [-2.3%; -0.9%] (maybe better)
startup:petclinic:profiling:Agent 16.60 s 16.67 s [-1.2%; +0.4%] (no difference)
startup:petclinic:sca:Agent 17.01 s 16.79 s [+0.3%; +2.3%] (maybe worse)
startup:petclinic:tracing:Agent 16.03 s 16.17 s [-1.7%; -0.1%] (maybe better)

Commit: 3d144d97 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core comp: remote config Configuration at Runtime tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant