-
Notifications
You must be signed in to change notification settings - Fork 315
Simplify context propagation #8719
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
Changes from all commits
057c8d9
cf88c2c
004ea1f
e56d51d
30b0291
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,17 +81,7 @@ private <C> void injectTraceParent(DDSpanContext context, C carrier, CarrierSett | |
|
|
||
| private <C> void injectTraceState(DDSpanContext context, C carrier, CarrierSetter<C> setter) { | ||
| PropagationTags propagationTags = context.getPropagationTags(); | ||
| if (propagationTags.getLastParentId() == null) { | ||
| if (context.isRemote()) { | ||
| CharSequence lastParentId = context.getLastParentId(); | ||
| if (lastParentId != null) { | ||
| propagationTags.updateLastParentId(lastParentId); | ||
| } | ||
| } else { | ||
| propagationTags.updateLastParentId(DDSpanId.toHexStringPadded(context.getSpanId())); | ||
| } | ||
| } | ||
|
|
||
| propagationTags.updateLastParentId(DDSpanId.toHexStringPadded(context.getSpanId())); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason for removing this here? It feels like to me that the end effect would be different since we are no longer checking for null before doing an update of the parentId? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, and the previous behavior feels bogus to me. We want the last parent id to be the current span id when injected, right? So with this change, I’m enforcing to always use the current span id as last parent id. Should I write some test to check for the expected behavior? -- and test it again master and this PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added some unit tests and @zacharycmontoya is writing some system tests here: DataDog/system-tests#4595 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI @PerfectSlayer the system-tests have been merged now with a Java skip |
||
| String tracestate = propagationTags.headerValue(W3C); | ||
| if (tracestate != null && !tracestate.isEmpty()) { | ||
| setter.set(carrier, TRACE_STATE_KEY, tracestate); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One feature in the RFC is that we don't want to include any span links that are created from
terminated_contextduring the extraction phase. The resetting of thelinksArrayList was to remove those, since there is a call toaddTerminatedContextAsLinks()in buildSpan, prior to the call tobuildSpanContext(). Maybe that call should be removed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was only an early try to check how the CI would behave.
Yes, the call from
buildSpanwent away, the main goal is to handle the terminated context / span link in a single location (buildSpanContext) to avoid multiple allocation.I keep trying thing in this PR, because I feel the
isRemote()behavior onDDSpanContextis wrong compared to its interface behavior. It's only usage what for last parent id tag, which also need improvements / refactoring.