Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/workerd/api/hibernatable-web-socket.c++
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ kj::Promise<WorkerInterface::CustomEvent::Result> HibernatableWebSocketCustomEve
co_await context.run(
[entrypointName = entrypointName, &context, eventParameters = kj::mv(eventParameters),
props = kj::mv(props)](Worker::Lock& lock) mutable {
jsg::AsyncContextFrame::StorageScope traceScope = context.makeAsyncTraceScope(lock);

KJ_SWITCH_ONEOF(eventParameters.eventType) {
KJ_CASE_ONEOF(text, HibernatableSocketParams::Text) {
return lock.getGlobalScope().sendHibernatableWebSocketMessage(kj::mv(text.message),
Expand Down
4 changes: 4 additions & 0 deletions src/workerd/api/worker-rpc.c++
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ class JsRpcTargetBase: public rpc::JsRpcTarget::Server {
// Note: No need to topUpActor() since this is the start of a top-level request, so the
// actor will already have been topped up by IncomingRequest::delivered().
return ctx.run([this, &ctx, callContext](Worker::Lock& lock) mutable {
// TODO(later): Create trace scope for STOR-4395. Is this the right place to do so, or
// should we try to do it earlier to capture any spans created in a constructor using
// Actor::ensureConstructed())?
jsg::AsyncContextFrame::StorageScope traceScope = ctx.makeAsyncTraceScope(lock);
return callImpl(lock, ctx, callContext);
});
}) {}
Expand Down
2 changes: 0 additions & 2 deletions src/workerd/io/io-context.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,6 @@ SpanParent IoContext::getCurrentTraceSpan() {
}

SpanParent IoContext::getCurrentUserTraceSpan() {
// TODO(o11y): Add support for retrieving span from storage scope lock for more accurate span
// context, as with Jaeger spans.
KJ_IF_SOME(workerTracer, getWorkerTracer()) {
return workerTracer.getUserRequestSpan();
}
Expand Down
3 changes: 3 additions & 0 deletions src/workerd/io/trace-stream.c++
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ class TailStreamTarget final: public rpc::TailStreamTarget::Server {
ioContext
.run([this, &ioContext, reportContext, ownReportContext = kj::mv(ownReportContext)](
Worker::Lock& lock) mutable -> kj::Promise<void> {
// TODO(later): STOR-4395 This method is generally called several times in a single
// customEvent. Should an async trace scope be created each time?

auto params = reportContext.getParams();
KJ_ASSERT(params.hasEvents(), "Events are required.");
auto eventReaders = params.getEvents();
Expand Down