-
Notifications
You must be signed in to change notification settings - Fork 603
Support user span context propagation #6407
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -369,13 +369,17 @@ void WorkerTracer::setEventInfoInternal( | |
| .entrypoint = mapCopyString(trace->entrypoint), | ||
| }; | ||
|
|
||
| tracing::SpanId parentSpanId = tracing::SpanId::nullId; | ||
| KJ_IF_SOME(trigger, context.getParent()) { | ||
| parentSpanId = trigger.getSpanId(); | ||
| } | ||
| // Onset needs special handling for spanId: The top-level spanId is zero unless a trigger | ||
| // context is available (not yet implemented). The inner spanId is taken from the invocation | ||
| // context is available. The inner spanId is taken from the invocation | ||
| // span context, that span is being "opened" with the onset event. All other tail events have it | ||
| // as its parent span ID, except for recursive SpanOpens (which have the parent span instead) | ||
| // and Attribute/SpanClose events (which have the spanId opened in the corresponding SpanOpen). | ||
| auto onsetContext = tracing::InvocationSpanContext( | ||
| context.getTraceId(), context.getInvocationId(), tracing::SpanId::nullId); | ||
| context.getTraceId(), context.getInvocationId(), parentSpanId); | ||
|
Contributor
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. This changes the onset event's top-level span ID from always Is this change covered by existing tests? I didn't find test coverage for the onset |
||
|
|
||
| // Not applying size accounting for Onset since it is sent separately | ||
| writer->report(onsetContext, | ||
|
|
@@ -627,4 +631,8 @@ kj::Date UserSpanObserver::getTime() { | |
| return IoContext::current().now(); | ||
| } | ||
|
|
||
| tracing::SpanId UserSpanObserver::getSpanId() { | ||
| return spanId; | ||
| } | ||
|
|
||
| } // namespace workerd | ||
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.
This field is set in
io-context.c++:1015but I don't see any code that reads it fromSubrequestMetadata. The downstream consumers (e.g.,server.c++:3272startSubrequest, the variousstartRequestimplementations) pass the metadata through but never accessuserSpanContext.Is consumption happening in the internal repo, or is this scaffolding for a follow-up? A brief comment here would help future readers understand the intent — e.g.: