Skip to content
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

Create and assign an InvocationSpanContext for every invocation #3145

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Nov 20, 2024

@fhanau ... please consider this one carefully. What I'm not sure about is whether the InvocationSpanContext should be held by the IncomingRequest or something internal to the RequestObserver.

Eventually I'd like to abstract out the WorkerTracer here and actually hide that inside the RequestObserver and put it entirely behind SpanBuilder but that'll come later. Accordingly, however, I don't want to put InvocationSpanContext inside the WorkerTracer.

The other thing to keep in mind is that we'll need to be able to propagate the InvocationSpanContext across subrequests of various kinds so we'll need easy access to it to place it into things like the control header.

How is this expected to be used? Good question! When streaming tail workers is fully operational, the invocation span context will be recorded with each mark event. Every child span created during the invocation of a worker will become a child off this root and should have its own kj::Rc<InvocationSpanContext> and there should always be a "current invocation span context" at any given time during an invocation that is propagated via the async context just like the current SpanParent. The fact that the user SpanBuilder would need to have access to this suggests to me that maybe the root InvocationSpanContext should be owned by the RequestObserver but I'm not entirely sure.

@jasnell jasnell requested review from a team as code owners November 20, 2024 16:57
@jasnell jasnell marked this pull request as draft November 20, 2024 17:12
Copy link
Collaborator

@fhanau fhanau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM, I'll have to think about IncomingRequest vs. RequestObserver a bit more.

@fhanau
Copy link
Collaborator

fhanau commented Nov 22, 2024

@fhanau ... please consider this one carefully. What I'm not sure about is whether the InvocationSpanContext should be held by the IncomingRequest or something internal to the RequestObserver.

The thoughts above seem reasonable, I don't have much to add. Intuitively, having the InvocationSpanContext be owned by RequestObserver in some capacity feels more sensible/easier to support, but I could also see it work with IncomingRequest. Having it in/around RequestObserver would be more in line with the current model, but I guess we're making big changes anyway.

@jasnell
Copy link
Member Author

jasnell commented Nov 22, 2024

Ok, well, we can keep it here for now and can always move it later if we discover it makes more sense in RequestObserver

@jasnell jasnell force-pushed the jsnell/invocationspancontext-for-every-invocation branch from ff8a831 to 47560cf Compare November 22, 2024 16:55
@jasnell jasnell marked this pull request as ready for review November 22, 2024 16:55
@jasnell jasnell merged commit 0aa984a into main Nov 22, 2024
14 checks passed
@jasnell jasnell deleted the jsnell/invocationspancontext-for-every-invocation branch November 22, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants