fix(tracer): skip JSON span-links serialization when using v1 protocol#4573
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: ea28b20 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-24 08:54:45 Comparing candidate commit ea28b20 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 217 metrics, 7 unstable metrics.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
What does this PR do?
Adds a
supportsLinks boolfield toSpan(mirroringsupportsEvents) and guardsserializeSpanLinksInMeta()so it becomes a no-op when the v1 protocol encoder is active.When the tracer uses the v1 protocol, span links are encoded as a native first-class field (field 11 of the span map).
serializeSpanLinksInMeta()was called unconditionally atfinish()time, so links were also serialized as a JSON string undermeta["_dd.span_links"]and re-emitted in the span attributes array. This caused every span with links to carry them twice in the v1 payload.The pattern mirrors how
serializeSpanEvents()handles the same problem for span events viasupportsEvents.Motivation
Identified as a misalignment between the v1 protocol's invariants and the tracer's finish-time serialization path. The v1 encoder handles span links natively; the JSON fallback path existed for agents that predate native span-link support in the msgp (v04) format and must be preserved for that path.
Reviewer's Checklist
make lintlocally.make testlocally.make generatelocally.