Repository navigation
Expose the trace's global tags and span defaults to serializers (OTLP trace/resource-level split) - #12960
Draft
dougqh wants to merge 2 commits into
Draft
Expose the trace's global tags and span defaults to serializers (OTLP trace/resource-level split)#12960dougqh wants to merge 2 commits into
dougqh wants to merge 2 commits into
Conversation
Serializers get the global tags (DD_TAGS, or their remote-config override) and the span defaults from the trace's config snapshot, so an OTLP export can write the global tags once as resource attributes instead of on every span. Both come from the snapshot the trace started with, so a config change mid-trace can't split one trace across two sets. getTags() is unchanged and still includes both. Test call sites pass empty maps; PayloadDispatcherImplTest's mocked PendingTrace now returns a real snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Adds two values to
Metadata, the per-span object serializers receive:getGlobalTags(): the trace's global tags (DD_TAGS, or their remote-config override);getSpanDefaultTags(): the trace's span defaults (DD_SPAN_TAGSplus tracer-defined tags such asenv), without the global tags.DDSpanContextfills both from the trace's config snapshot (TraceCollector.getTraceConfig()), using the maps #12937 added. Every span in a trace shares its collector's snapshot, so a config change mid-trace can't split one trace across two sets of global tags.getTags()is unchanged and still includes both. Serializers that don't care about tag levels need no changes.Motivation
This gets #12813 (OTLP) what it needs to write
DD_TAGSonce on the Resource instead of on every span, without reaching intoTagMapinternals or comparing values against the staticConfig:getSpanDefaultTags()minus the keys the span sets itself;getGlobalTags().The encoder change itself stays with #12813.
The accessors are named for what the tags are, not where they come from. If trace-level state later moves to its own object (a trace segment), only
DDSpanContextchanges and serializers don't notice.Additional Notes
Metadata(one per serialized span, on the serializer thread) and one field read from the trace's snapshot. No change on the application thread.CoreTracerTest.metadataCarriesTheTraceConfigTagLevels: a span started before a config change still serializes its trace's original maps (same instances);Metadataconstructor call sites in tests passTagMap.EMPTY;PayloadDispatcherImplTestbuilds a realDDSpanContexton a mockedPendingTracewhose default answer returned a null snapshot. It now returns a real one. In production the snapshot is never null:PendingTraceandStreamingTraceCollectorfall back tocaptureTraceConfig().dd-trace-core: the only failures are two Docker-based tests (no Docker locally) and two known timing tests (DDAgentWriterCombinedTest,PendingTraceBufferTest). Both timing tests pass when run on their own.dd-trace-otpasses, and thetraceAgentTestandjmhsource sets compile.Jira ticket: [PROJ-IDENT]
🤖 Generated with Claude Code