feat(rivetkit): pass trace context to js and logs - #5723
Conversation
| ctx: ActorContextHandle, | ||
| ): ActorInvocationTraceContext | undefined { | ||
| return this.#actorInvocationTraceContext(asNativeActorContext(ctx)); | ||
| } | ||
|
|
There was a problem hiding this comment.
🟠 Medium · Resolve trace context through the active invocation
actorInvocationTraceContext reads the context captured when the client was created, rather than the invocation in #invocationContext. A client can be retained in actor state/vars (or captured by run) and used during a later action; its captured context has already finished, so this returns undefined and the actor-to-actor request drops both trace headers and the ray ID.
This runtime already resolves SQLite operations through #actorContextForOperation for this exact retained-handle case. Use that resolver before reading invocationTraceContext() so a same-instance active action supplies its current context.
|
Code Review Re-reviewed against the current diff (updated 2026-09-22, HEAD Findings
Minor / lower confidence
Test coverage
Notes
🤖 Generated with Claude Code |
6a1b670 to
483d6f1
Compare
| ctx: ActorContextHandle, | ||
| ): ActorInvocationTraceContext | undefined { | ||
| return this.#actorInvocationTraceContext(asNativeActorContext(ctx)); | ||
| } | ||
|
|
There was a problem hiding this comment.
🟠 Medium · Resolve trace context through the active invocation
actorInvocationTraceContext reads the context captured when the client was created, rather than the invocation in #invocationContext. A client can be retained in actor state/vars (or captured by run) and used during a later action; its captured context has already finished, so this returns undefined and the actor-to-actor request drops both trace headers and the ray ID.
This runtime already resolves SQLite operations through #actorContextForOperation for this exact retained-handle case. Use that resolver before reading invocationTraceContext() so a same-instance active action supplies its current context.
followed up in #5732, including overlapping invocations
followed up in #5726 and #5732
my clank in christ, you really love this don't you
the waitUntil driver test checks the exported span's lifetime
yeah ig? |
483d6f1 to
08b79f2
Compare
| ctx: ActorContextHandle, | ||
| ): ActorInvocationTraceContext | undefined { | ||
| return this.#actorInvocationTraceContext(asNativeActorContext(ctx)); | ||
| } | ||
|
|
There was a problem hiding this comment.
🟠 Medium · Resolve trace context through the active invocation
actorInvocationTraceContext reads the context captured when the client was created, rather than the invocation in #invocationContext. A client can be retained in actor state/vars (or captured by run) and used during a later action; its captured context has already finished, so this returns undefined and the actor-to-actor request drops both trace headers and the ray ID.
This runtime already resolves SQLite operations through #actorContextForOperation for this exact retained-handle case. Use that resolver before reading invocationTraceContext() so a same-instance active action supplies its current context.
08b79f2 to
58dfd19
Compare
58dfd19 to
9df89c4
Compare
9df89c4 to
831cfcf
Compare
831cfcf to
16670ba
Compare
16670ba to
4da8a6c
Compare
4da8a6c to
f19cca8
Compare
f19cca8 to
dc29956
Compare
dc29956 to
c820481
Compare
c820481 to
561a425
Compare
waitUntilwork finishes