feat(rivetkit-core): trace raw http requests - #5731
Conversation
|
Review Reviewed the current diff for PR #5731 ( Findings 1. Streaming response bodies finish the request span before the body actually drains (
If the pull() callback of a handler performs work after headers are sent, e.g. Suggest deferring 2. Inconsistent error.type format for 5xx onRequest responses ( For a 5xx Suggest normalizing to the same group.code convention, e.g. mapping the status code to an HTTP-specific group/code pair, for consistency with Other notes
🤖 Generated with Claude Code |
fef3828 to
9222dd9
Compare
There was a problem hiding this comment.
🟠 2 medium-severity findings
Reviewed commit 9222dd9.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
Original location: "rivetkit-typescript/packages/rivetkit-wasm/src/lib.rs":854 (new side, not submitted inline).
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
intentional |
9222dd9 to
ce83ec0
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
ce83ec0 to
09e5b53
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
09e5b53 to
2611ec9
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
2611ec9 to
66fb8ec
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
66fb8ec to
164632c
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
164632c to
0b5ee8f
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
0b5ee8f to
c4bfafb
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
c4bfafb to
0bd6bbf
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
0bd6bbf to
bb278a9
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
bb278a9 to
8108c11
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
8108c11 to
1870777
Compare
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { | ||
| request, | ||
| invocation_telemetry: _, |
There was a problem hiding this comment.
🟠 Medium · Bind raw HTTP telemetry to the Rust handler context
The newly-created telemetry is discarded before on_fetch_response is invoked. A Rust actor's HTTP handler therefore receives the original Ctx with no invocation telemetry, so ctx.invocation_sql() and schedule operations cannot create children of this raw-request span.
Bind invocation_telemetry with ctx.with_invocation_telemetry(...) before invoking the HTTP handler, rather than matching it as _.
| ); | ||
| } | ||
| ActorEvent::HttpRequest { request, reply } => { | ||
| ActorEvent::HttpRequest { |
There was a problem hiding this comment.
🟠 Medium · Carry raw HTTP telemetry into the Wasm callback context
The Wasm handler discards the telemetry attached to HttpRequest and passes the unbound ctx to JavaScript. Raw requests on the Wasm runtime therefore emit only the root request span; SQLite and scheduling work initiated through the callback cannot be attributed to it.
Create a context with ctx.with_invocation_telemetry(invocation_telemetry) before constructing the callback payload, as the runtime-specific handlers must bind the event telemetry to the context they expose.
onRequesthandlers with the HTTP method, response status and errors