You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds observability (latency timing + serialize/deserialize size histograms) to raw serde_bare call sites by routing them through the rivet_util::serde::bare_from_slice! / bare_to_vec! macros, and does the same for one serde_json::from_str call in gasoline via json_from_str!. Mechanical, wide-reaching, but low risk in intent.
Issues Found
Build-breaking: rivet-depot-protocol is missing the rivet-util dependency
engine/sdks/rust/depot-protocol/src/versioned.rs now calls rivet_util::serde::bare_from_slice!(payload) and rivet_util::serde::bare_to_vec!(&data) (lines 24 and 31), but engine/sdks/rust/depot-protocol/Cargo.toml was not updated to add rivet-util.workspace = true. Every other crate touched by this PR (depot, engine, epoxy, gasoline, pegboard-runner, pegboard, runner-protocol, data, envoy-protocol, epoxy-protocol, ups-protocol) already has rivet-util as a dependency, and Cargo.lock confirms rivet-depot-protocol's dependency list still has no rivet-util entry:
Since rivet_util::... is invoked by its crate path directly in versioned.rs, this needs rivet-util declared in that crate's own Cargo.toml, not just transitively available -- cargo check -p rivet-depot-protocol should fail to resolve the rivet_util crate name. Fix: add rivet-util.workspace = true to engine/sdks/rust/depot-protocol/Cargo.toml (and regenerate the corresponding Cargo.lock entry).
Minor: doc-comment copy/paste error in engine/packages/util/src/serde.rs
Lines 81 and 96 both now read /// Wraps \rivet_util::serde::bare_to_vec!` with observability.Line 81 correctly documentsbare_to_vec!, but line 96 documents bare_from_slice!and should referencebare_from_slice!(or the underlyingserde_bare::from_slice), not bare_to_vec!`.
What Looks Good
Every other OwnedVersionedData impl and FormalKey impl in the touched protocol/depot/pegboard crates is consistently migrated, including the version-specific match arms (each version keeps its own deserialize/serialize path, no accidental collapsing of variants).
The rivet-util-serde to rivet-util dependency swap in envoy-protocol/Cargo.toml (and the pegboard-runner/Cargo.toml addition) is consistent with the macros living in rivet_util::serde.
The compat_ack_tunnel_message change in pegboard-runner/src/ws_to_tunnel_task.rs correctly adds an explicit : protocol_v2::ToServer type annotation since the macro doesn't support a turbofish.
The gasoline StateGuard::new change from rivet_util::observe!(serde_json::from_str::<T>(guard.0.get())?) to rivet_util::serde::json_from_str!(guard.0.get())? is semantically equivalent: type inference still resolves T from the surrounding Self { ... inner: value } struct literal, and json_from_str! already wraps with observe! plus adds a size histogram.
The engine/packages/engine/src/commands/udb/cli.rs changelog-entry roundtrip check preserves its original early-continue fallback behavior on both the deserialize and reserialize failure paths.
No unbounded metric labels introduced -- the location label on SERIALIZE_SIZE/DESERIALIZE_SIZE is a compile-time file:line:column, bounded by call-site count.
No wire-format/schema changes; this is purely instrumentation at existing call sites.
Suggestion
Given cargo check -p rivet-depot-protocol (and anything depending on it, e.g. depot) should currently fail, it would be worth confirming CI actually ran a full workspace build/check on this PR before merge.
MasterPtato
changed the base branch from
main
to
stack/add-observation-and-ser-de-metrics-for-serde-calls-ztnuwvtsAugust 7, 2026 01:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.