Skip to content

chore(envoy-client): log command and event payloads#4751

Draft
NathanFlurry wants to merge 1 commit intosleep-cleanup/16-minor-fixesfrom
sleep-cleanup/11-info-log-envoy-commands-events
Draft

chore(envoy-client): log command and event payloads#4751
NathanFlurry wants to merge 1 commit intosleep-cleanup/16-minor-fixesfrom
sleep-cleanup/11-info-log-envoy-commands-events

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Summary

  • log each decoded envoy command wrapper at info level when commands arrive
  • log each event wrapper at info level when events are sent or resent

Verification

  • cargo check -p rivet-envoy-client

@claude
Copy link
Copy Markdown

claude Bot commented Apr 24, 2026

PR Review: chore(envoy-client): log command and event payloads

Note: This is a draft PR — feedback assumes it will eventually be promoted.

Summary

The PR adds per-item structured logging to three envoy-client functions: handle_commands, handle_send_events, and resend_unacknowledged_events. The implementation is clean and follows project conventions, but a few issues are worth addressing before promoting this to ready.


Issues

1. Log level is too verbose for production (infodebug or trace)

Per-item command/event logs will be very noisy under load. The aggregate count lines (received commands, resending unacknowledged events) are reasonable at info, but individual item logs should be debug or trace:

// Keep at info
tracing::info!(command_count = commands.len(), "received commands");

// Lower to debug
for command_wrapper in &commands {
    tracing::debug!(
        command = %stringify_command_wrapper(command_wrapper),
        "received command"
    );
}

2. stringify_* functions are called unconditionally

In Rust, macro arguments are evaluated before the macro executes, so stringify_command_wrapper(command_wrapper) is always called — even when the effective log level is above info. Lowering to debug/trace means this cost only appears when explicitly opted-in, which avoids overhead in production.

3. Inconsistent count field names

handle_send_events uses event_count but the pre-existing resend_unacknowledged_events site uses count. Since you're touching both sites, worth unifying:

// events.rs — resend path (pre-existing, should match)
tracing::info!(event_count = events.len(), "resending unacknowledged events");

4. actor_id should be a separate structured field

The actor ID is embedded inside the stringified output but is not queryable as a top-level field. Structured log search works much better when important identifiers are promoted:

tracing::debug!(
    actor_id = %command_wrapper.checkpoint.actor_id,
    command = %stringify_command_wrapper(command_wrapper),
    "received command"
);

5. Double iteration over commands in commands.rs

The logging loop iterates &commands separately before the processing loop. Consider logging inside the existing processing loop to avoid the extra pass, or — once the level is lowered to debug — guard it with tracing::enabled!(tracing::Level::DEBUG) to skip the loop entirely when debug logging is off.


Minor

  • Log messages follow the lowercase convention from CLAUDE.md ✓
  • Structured field format (command = %stringify_command_wrapper(...)) follows tracing conventions ✓
  • No functional logic was changed ✓

Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@NathanFlurry NathanFlurry force-pushed the sleep-cleanup/16-minor-fixes branch from 2893e31 to 8f8ecec Compare April 24, 2026 13:16
@NathanFlurry NathanFlurry force-pushed the sleep-cleanup/11-info-log-envoy-commands-events branch from 70cd023 to 297aa8b Compare April 24, 2026 13:16
@github-actions
Copy link
Copy Markdown
Contributor

Preview packages published to npm

Install with:

npm install rivetkit@pr-4751

All packages published as 0.0.0-pr.4751.26b9398 with tag pr-4751.

Engine binary is shipped via @rivetkit/engine-cli on linux-x64-musl, linux-arm64-musl, darwin-x64, and darwin-arm64. Windows users should use the release installer or set RIVET_ENGINE_BINARY.

Docker images:

docker pull rivetdev/engine:slim-26b9398
docker pull rivetdev/engine:full-26b9398
Individual packages
npm install rivetkit@pr-4751
npm install @rivetkit/react@pr-4751
npm install @rivetkit/rivetkit-napi@pr-4751
npm install @rivetkit/workflow-engine@pr-4751

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