-
Notifications
You must be signed in to change notification settings - Fork 20
feat(tracing): add span link support #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gh-worker-dd-mergequeue-cf854d
merged 33 commits into
main
from
milan.garnier/span-links-support
Jul 22, 2026
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
fad515b
add span link struct and test
MilanGarnier 0796973
enable span link tests
MilanGarnier 0fecaca
implement Span::add_link
MilanGarnier f254562
add span link to msg pack encoding
MilanGarnier 58cf95d
add spn link test for the Span class
MilanGarnier 84a7ef4
implenent add_link endpoint for parametric tests
MilanGarnier 65382c4
flatten array
MilanGarnier ecfb7cc
cleaner spanlink construction
MilanGarnier eecfe93
add extracted context struct
MilanGarnier c4ae457
cleaning up (move logic to span.cpp)
MilanGarnier 86d189e
format
MilanGarnier dff6677
fix BAZEL build
MilanGarnier 1a36ade
derive W3C flags from sampling priority in add_link(ExtractedContext)
MilanGarnier 6c2f121
resolve https://github.com/DataDog/dd-trace-cpp/pull/330#discussion_r…
MilanGarnier 5c93eca
change scope of ExtractedHeaders struct (restrict to parametric server)
MilanGarnier 5311345
case insensitive lookup for headers
MilanGarnier f62084f
nit: nested namespace syntax
MilanGarnier 9ac8c2b
clearer variable names
MilanGarnier f736ab5
get rid of magic values in span_data::msgpack
MilanGarnier 0da2fea
Cleaner msgpack_encode for span_link.cpp
MilanGarnier 64882ca
split RequestHandler::on_add_link
MilanGarnier a1a3484
make storedLinkContexts outside of on_extract_headers function
MilanGarnier 0b3959a
bugfix: do not force sampling decision when writing tracestate in
MilanGarnier f033eef
avoid collisions when adding links consecutively (parent_id=0)
MilanGarnier a035447
move span link into private types, expose spancontext and spanlinkatt…
MilanGarnier 6762038
always store trace_id_high
MilanGarnier 58fcb18
fix typo in parametric server
MilanGarnier 3d7b510
refact(tracing): nit change comment
MilanGarnier 59a0589
refactor(tracing): move span link attributes type to span.h
MilanGarnier 83f80f0
refactor(tracing): make SpanContext a class; SpanLink wraps SpanContext
MilanGarnier 4e38c82
test(system-tests): adapt request_handler to SpanContext constructor API
MilanGarnier 3442a87
do not care about sampling priority when adding span link
MilanGarnier dbee998
Merge branch 'main' into milan.garnier/span-links-support
MilanGarnier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #pragma once | ||
|
|
||
| // This component defines `SpanContext`, the identifying and propagation state | ||
| // of a span. It can be supplied to `Span::add_link` to associate a span with a | ||
| // span in this or another trace. | ||
|
|
||
| #include <cstdint> | ||
| #include <string> | ||
|
|
||
| #include "trace_id.h" | ||
|
|
||
| namespace datadog::tracing { | ||
|
|
||
| class SpanContext { | ||
| public: | ||
| // 128-bit trace ID of the span. | ||
| TraceID trace_id; | ||
| // ID of the span within its trace. | ||
| std::uint64_t span_id; | ||
| // W3C `tracestate` header value, if any. | ||
| Optional<std::string> tracestate; | ||
| // W3C trace flags, if any. | ||
| Optional<std::uint32_t> flags; | ||
|
|
||
| SpanContext(TraceID trace_id, std::uint64_t span_id, | ||
| Optional<std::string> tracestate = nullopt, | ||
| Optional<std::uint32_t> flags = nullopt) | ||
| : trace_id(trace_id), | ||
| span_id(span_id), | ||
| tracestate(tracestate), | ||
| flags(flags) {} | ||
| }; | ||
|
|
||
| } // namespace datadog::tracing | ||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.