Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR propagates user span context to subrequest metadata and wires up the parent span ID in onset events for streaming tail workers.
-
[MEDIUM]
userSpanContextis populated but never consumed. The newSubrequestMetadata::userSpanContextfield is set inio-context.c++but no downstream code (inserver.c++or elsewhere) reads it. If this is intentional scaffolding for a follow-up (or consumed in the internal repo), a brief comment explaining that would be helpful. Otherwise this is dead code. -
[LOW] No tests for the onset
parentSpanIdbehavior change. The change intracer.c++alters thespanIdin the onsetInvocationSpanContextfrom always-null to the trigger's span ID when a parent is present. This is a behavioral change to tail event output. Consider adding a test that verifies the onset event carries the correct parent span ID when a trigger context is available.
This review was generated by an AI assistant and may contain inaccuracies.
| SpanParent parentSpan = SpanParent(nullptr); | ||
|
|
||
| // User Span Context for trace propagation. | ||
| kj::Maybe<tracing::SpanContext> userSpanContext; |
There was a problem hiding this comment.
This field is set in io-context.c++:1015 but I don't see any code that reads it from SubrequestMetadata. The downstream consumers (e.g., server.c++:3272 startSubrequest, the various startRequest implementations) pass the metadata through but never access userSpanContext.
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.:
| kj::Maybe<tracing::SpanContext> userSpanContext; | |
| // User Span Context for trace propagation. Consumed by [describe consumer]. | |
| kj::Maybe<tracing::SpanContext> userSpanContext; |
| // 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); |
There was a problem hiding this comment.
This changes the onset event's top-level span ID from always nullId to the trigger's spanId when a parent context exists. This is a behavioral change to the tail event wire format — streaming tail workers will now see a non-zero span ID in onset events for triggered invocations.
Is this change covered by existing tests? I didn't find test coverage for the onset spanId value. Consider adding a test case (in the trace/tracer tests) that verifies the onset context carries the parent's span ID when a trigger is present, and nullId when it isn't.
|
I've posted my review on PR #6407 with two findings:
The |
89f290d to
37f5080
Compare
No description provided.