Skip to content

Commit 70cd023

Browse files
committed
chore(envoy-client): log command and event payloads
1 parent 2893e31 commit 70cd023

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

engine/sdks/rust/envoy-client/src/commands.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ use rivet_envoy_protocol as protocol;
33
use crate::actor::create_actor;
44
use crate::connection::ws_send;
55
use crate::envoy::EnvoyContext;
6+
use crate::stringify::stringify_command_wrapper;
67

78
pub const ACK_COMMANDS_INTERVAL_MS: u64 = 5 * 60 * 1000;
89

910
pub async fn handle_commands(ctx: &mut EnvoyContext, commands: Vec<protocol::CommandWrapper>) {
1011
tracing::info!(command_count = commands.len(), "received commands");
12+
for command_wrapper in &commands {
13+
tracing::info!(
14+
command = %stringify_command_wrapper(command_wrapper),
15+
"received command"
16+
);
17+
}
1118

1219
for command_wrapper in commands {
1320
let checkpoint = command_wrapper.checkpoint;

engine/sdks/rust/envoy-client/src/events.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ use rivet_envoy_protocol as protocol;
22

33
use crate::connection::ws_send;
44
use crate::envoy::EnvoyContext;
5+
use crate::stringify::stringify_event_wrapper;
56

67
pub async fn handle_send_events(ctx: &mut EnvoyContext, events: Vec<protocol::EventWrapper>) {
8+
tracing::info!(event_count = events.len(), "sending events");
9+
for event in &events {
10+
tracing::info!(event = %stringify_event_wrapper(event), "sending event");
11+
}
12+
713
// Record in history per actor
814
for event in &events {
915
let mut remove_after_stop = false;
@@ -60,6 +66,9 @@ pub async fn resend_unacknowledged_events(ctx: &EnvoyContext) {
6066
}
6167

6268
tracing::info!(count = events.len(), "resending unacknowledged events");
69+
for event in &events {
70+
tracing::info!(event = %stringify_event_wrapper(event), "resending event");
71+
}
6372

6473
ws_send(&ctx.shared, protocol::ToRivet::ToRivetEvents(events)).await;
6574
}

0 commit comments

Comments
 (0)