Skip to content

[SLOP(claude-opus-4-8)] feat(rivetkit-core): add serde duration and size metrics - #5322

Open
MasterPtato wants to merge 1 commit into
stack/add-observation-for-serde_bare-oskoutmwfrom
stack/slop-claude-opus-4-8-feat-rivetkit-core-add-serde-duration-and-size-metrics-nqkrytvr
Open

[SLOP(claude-opus-4-8)] feat(rivetkit-core): add serde duration and size metrics#5322
MasterPtato wants to merge 1 commit into
stack/add-observation-for-serde_bare-oskoutmwfrom
stack/slop-claude-opus-4-8-feat-rivetkit-core-add-serde-duration-and-size-metrics-nqkrytvr

Conversation

@MasterPtato

@MasterPtato MasterPtato commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@MasterPtato

MasterPtato commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Stack for rivet-dev/rivet

Get stack: forklift get 5322
Push local edits: forklift submit
Merge when ready: forklift merge 5322

change nqkrytvr

@claude

claude Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review

Adds duration/size Prometheus histograms for serde hot paths in rivetkit-core, following the same LazyLock collector + register_metric-with-warn-on-duplicate pattern already used by rivet-envoy-client (engine/sdks/rust/envoy-client/src/metrics.rs), and reuses the exact byte-size buckets from the engine-side SERIALIZE_SIZE/DESERIALIZE_SIZE metrics (engine/packages/util/src/metrics.rs). Labels (format, location) are bounded/code-defined, consistent with the metrics cardinality rules in CLAUDE.md. crate::time::Instant is used correctly for wasm compatibility, and rivet_metrics is already an unconditional dependency of this crate (see metrics_endpoint.rs), so no new wasm-compat risk.

Findings

  1. Inconsistent instrumentation coverage in http.rs. decode_http_action_args/encode_http_action_response are wrapped with serde_metrics::measure_*, but the structurally identical queue counterparts, decode_http_queue_request (registry/http.rs:878) and encode_http_queue_response (registry/http.rs:957), are left uninstrumented. If the goal is observability into serde hot paths, the queue send/response path is a real gap, not just a style inconsistency, worth wrapping in the same change or filing a follow-up.

  2. No test coverage for the new module. serde_metrics.rs has no accompanying tests, even though this crate already has an established pattern for exactly this kind of thing in tests/metrics.rs (e.g. duplicate_metric_registration_uses_noop_fallback, actor_startup_duration_metrics_render, which render global metrics and assert on labeled values). A similar test asserting rivetkit_serialize_size/rivetkit_deserialize_size/*_duration_seconds get recorded with the right format/location labels (and that failed deserialization still records size) would catch label typos and regressions.

  3. Minor doc nit: the module doc says it "mirror[s] the engine-side serde observability," but the engine side (engine/packages/util/src/metrics.rs) only has SERIALIZE_SIZE/DESERIALIZE_SIZE (size only, no duration histograms). Not a blocker, just slightly overstates the parity.

  4. PR title includes [SLOP(claude-opus-4-8)]. Per CLAUDE.md, commit/PR titles must be pure conventional commits with no agent/model markers. Worth stripping before merge if this was not intentional tooling metadata.

Nothing else stood out. The closures in decode_http_action_args/encode_http_action_response correctly preserve existing error propagation via ?, persist.rs callers all pass static bounded label strings (no unbounded cardinality), and hard-tab formatting is intact.

@NathanFlurry NathanFlurry changed the title [SLOP(claude-opus-4-8)] feat(rivetkit-core): add serde duration and size metrics feat(rivetkit-core): add serde duration and size metrics Jun 26, 2026
@MasterPtato MasterPtato changed the title feat(rivetkit-core): add serde duration and size metrics [SLOP(claude-opus-4-8)] feat(rivetkit-core): add serde duration and size metrics Jun 29, 2026
@MasterPtato
MasterPtato changed the base branch from stack/add-observation-for-serde_bare-oskoutmw to main August 7, 2026 00:39
@MasterPtato
MasterPtato force-pushed the stack/slop-claude-opus-4-8-feat-rivetkit-core-add-serde-duration-and-size-metrics-nqkrytvr branch from c1222cc to 7717f5d Compare August 7, 2026 01:27
@MasterPtato
MasterPtato changed the base branch from main to stack/add-observation-for-serde_bare-oskoutmw August 7, 2026 01:27
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