chore(rivetkit): add child spans for logging#4734
Conversation
2a3027f to
fbf0f28
Compare
54026cd to
fbc8b08
Compare
fbf0f28 to
b73cea0
Compare
fbc8b08 to
475a302
Compare
Code Review: chore(rivetkit): add child spans for logging
Summary of changes
IssuesBreaking API change (no migration path documented)
// Before
pub async fn serve(self) -> Result<()>
pub async fn serve_with_config(self, config: ServeConfig) -> Result<()>
// After
pub async fn serve(self, shutdown: CancellationToken) -> Result<()>
pub async fn serve_with_config(self, config: ServeConfig, shutdown: CancellationToken) -> Result<()>Same break on the Log level inflation — info used for internal lifecycle noiseMany of the new statements log at
Concretely, a single client action today generates at least 10 separate Redundant actor_id re-logged inside an instrumented span
SHUTDOWN_DRAIN_TIMEOUT defined twice// rivetkit-core/src/registry/mod.rs
const SHUTDOWN_DRAIN_TIMEOUT: Duration = Duration::from_secs(20);
// rivetkit-core/src/serverless.rs
const SHUTDOWN_DRAIN_TIMEOUT: Duration = Duration::from_secs(20);Define once in a shared location; drift between these two will cause inconsistent drain behavior. ensure_envoy TOCTOU race in serverless.rsif self.shutting_down.load(Ordering::Acquire) {
return Err(RuntimeShutDown.build());
}
let mut guard = self.envoy.lock().await;
// ... gap where shutdown() can run and take() the handle ...
Comment style violations (CLAUDE.md §Comments)Several new comments reference implementation artifacts that will rot:
Per CLAUDE.md: comments should explain why in terms of constraints or invariants, not reference current task, fix, or spec sections. Missing newline at end of artifact file
JSON tracing format is now unconditional in NAPItracing_subscriber::fmt()
.json()
// ...The format switch is global and permanent for any Node process embedding rivetkit. Logfmt was removed from the TS side in the same PR, so the two layers now diverge: JS/Pino emits its own format, Rust emits JSON on stdout. If the intent is structured JSON end-to-end that is fine, but it should be configurable (or at minimum called out explicitly since it changes developer UX). Minor observations
What looks good
🤖 Generated with Claude Code |
b73cea0 to
c59f860
Compare
475a302 to
36cef20
Compare
36cef20 to
a70e758
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: