Skip to content

feat(rivetkit): trace actor to actor calls - #5732

Open
eersnington wants to merge 1 commit into
stack/feat-rivetkit-core-trace-queue-sends-and-receives-wqpoztoqfrom
stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx
Open

eersnington wants to merge 1 commit into
stack/feat-rivetkit-core-trace-queue-sends-and-receives-wqpoztoqfrom
stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx

Conversation

@eersnington

@eersnington eersnington commented Sep 15, 2026

Copy link
Copy Markdown
Member
  • Tracing HTTP action calls between actors, including routing, retries and wake time
  • Connecting both actors' work in the same trace
  • Testing that overlapping calls keep their traces and logs separate

@claude

claude Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review: feat(rivetkit): trace actor to actor calls

Reviewed the diff across rivetkit-core, the NAPI bridge, and the TypeScript client. Overall this is a well-scoped, carefully-commented change that follows the repo's telemetry conventions closely (matches the existing SqliteOperationSpan pattern for span lifecycle/Drop semantics, reuses RivetError::extract for sanitized error.type, keeps rivetkit-core as the source of truth and the NAPI layer as pure bindings).

Correctness

  • OutboundCallInvocation/OutboundCall lifecycle looks sound: finish() consumes/takes the span so a second call is a no-op, and Drop marks an un-finished call as actor.operation_abandoned, mirroring SqliteOperationSpan. The rivetkit-typescript/.../actor-handle.ts action() call site wraps every path (success, retry, destroy short-circuit) in try/finally-style call.finish()/call.finish(error), so I didn't find a leak in the JS call site itself.
  • The header-precedence change in outbound-telemetry.ts (callSpan ?? active OTel context ?? invocation span) is consistent with the new parent_context()-based application-span parenting already used for SQL, and the two new driver tests (parents SQLite and outgoing calls under the actor's own application span, preserves vendor trace state across actor calls) exercise it well.
  • Retrying via retryOnLifecycleBoundary intentionally reuses one callSpan across all attempts (per the comment), so multiple physical HTTP attempts collapse into one client-side span. That's a reasonable simplification, just noting it means individual retry attempts aren't separately visible in the call span.

Coverage gap worth a second look

  • The new call span is only wired into ActorHandleRaw.action() (rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts:294-321). ActorConn's WebSocket-based action calls (actor-conn.ts:238) and raw ActorHandleRaw.fetch()/#fetchWithResolvedActor (actor-handle.ts:722) still only forward currentActorInvocation and never open a rivet.actor.call span. fetch() in particular is still an HTTP call between actors, so it's an inconsistent trace boundary with .action(). If this is intentionally out of scope (PR description says "Tracing HTTP action calls"), it'd be worth a one-line note/follow-up so it doesn't look like an oversight later.

Test coverage

  • Good driver-level (NAPI, integration) coverage for isolation, application-span parenting, and vendor tracestate/invalid-version propagation. There's no Rust-level unit test under rivetkit-core/tests/ exercising start_outbound_call/OutboundCallInvocation (e.g. the dropped/never-finished → actor.operation_abandoned path, or parent_context() == NoneNone returned) in isolation from the full NAPI+driver stack. Not blocking, but a small core-level test would pin the Drop/finish semantics more cheaply than the e2e suite.

Minor nits

  • Import order in client.ts/actor-handle.ts (StartCallSpan before CurrentActorInvocation) is alphabetically reversed vs the rest of the codebase's import style; likely harmless but may trip a formatter/lint pass.
  • The new rivet.actor.call span omits the caller's own rivet.actor.id/rivet.actor.name fields that rivet.sqlite.operation spans include (only callee actor_name/action_name are attached). Presumably fine since it nests under the invocation span which already carries caller identity, but flagging in case that's an oversight rather than a deliberate choice.

No security concerns — actor_name/action_name come from the caller's own registry rather than untrusted input, and error text crossing the bridge goes through RivetError::extract/isCanonicalStructuredRivetError for sanitization rather than being trusted verbatim, consistent with the trust-boundary rules in CLAUDE.md.

🤖 Generated with Claude Code

@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from bc77372 to 384b32b Compare September 16, 2026 01:18

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 384b32b.


🟠 Medium · Keep outbound call tracing available on wasm

Every client created inside a wasm-hosted actor now receives beginOutboundCall, but this adapter always returns undefined. Its action calls therefore continue to propagate the invocation context directly and never emit the new client span, unlike the NAPI runtime.

Expose the core context operation through the wasm binding and forward it here (including its span and finish), rather than using this placeholder, so the portable CoreRuntime contract has the same tracing behavior on both runtimes.

Original location: "rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts":550 (new side, not submitted inline).

Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 384b32b to 7f1d947 Compare September 16, 2026 17:51

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 7f1d947.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 7f1d947 to 41a28e0 Compare September 16, 2026 18:08

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 41a28e0.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 41a28e0 to 945ecce Compare September 16, 2026 18:16

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 945ecce.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
Comment thread rivetkit-rust/packages/rivetkit-core/src/telemetry.rs
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 945ecce to 8395b1b Compare September 16, 2026 18:24

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 8395b1b.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 8395b1b to d485500 Compare September 16, 2026 18:34

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit d485500.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from d485500 to f9dcaf3 Compare September 16, 2026 18:42

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit f9dcaf3.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from f9dcaf3 to ae9c32e Compare September 16, 2026 19:13

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit ae9c32e.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from ae9c32e to 241f2c1 Compare September 16, 2026 20:28

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 241f2c1.

Comment thread rivetkit-typescript/packages/rivetkit/src/registry/wasm-runtime.ts
Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington added this pull request to stack #5746 September 17, 2026 08:36
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 241f2c1 to 9d7ac37 Compare September 17, 2026 15:14

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 2 medium-severity findings

Reviewed commit 9d7ac37.

Comment on lines +555 to +560
_actorName: string,
_actionName: string,
): RuntimeOutboundCall | undefined {
return undefined;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 Medium · Keep outbound call tracing available on wasm

Every actor client now receives beginOutboundCall, but this adapter always returns undefined. Actions issued by wasm-hosted actors therefore still propagate the invocation span directly and never emit the new client span, unlike the NAPI runtime.

Forward the core context operation through the wasm binding (including its span context and finish operation) rather than returning this placeholder so the portable CoreRuntime contract has matching tracing behavior.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nope. out of scope

Comment thread rivetkit-typescript/packages/rivetkit/src/client/actor-handle.ts
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from 9d7ac37 to aeeb217 Compare September 18, 2026 22:40

@the-company-company the-company-company Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found

Reviewed commit aeeb217.

@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from aeeb217 to e143d11 Compare September 19, 2026 01:01
@eersnington
eersnington force-pushed the stack/feat-rivetkit-trace-actor-to-actor-calls-zosqvyzx branch from e143d11 to 6f7295c Compare September 21, 2026 22:56

This branch has not been deployed

No deployments
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.

1 participant