Repository navigation
feat(id): F11.7 slice 1 — host metrics core + world stats surfacing (#553) - #1437
Conversation
… mid-verification, resume from here Metrics registry (world/metrics.rs, atomics + fixed-bucket histograms) shared by actor/handle/session; actor records command latency, queue depth, journal append latency (in persist), checkpoint duration (in compact_if_due); session layer meters frame bytes in send_json; Metrics actor command + handle.metrics(); metrics session frame (pre-join and joined, capability-authorized like info); client WorldClient::metrics; id world stats gains a metrics object. Tests: metrics unit test, session scripted-session metrics test, durable journal-append metrics test. Verification state at handoff: cargo check --lib showed the Histogram Default error (fixed after that run) plus two 'service not in scope' errors in the meter threading to locate; cargo check --tests was still compiling. Next: cargo check --no-default-features --tests, fix any remaining meter scope sites, run the three metrics tests, then PR.
…view (queue task 1305 resume) Both functions take &WorldHandle, not &WorldService, so the WIP's service.frame_meter() calls there do not resolve. Add a meter: &WorldMetrics parameter (the send_delegation pattern) and pass service.frame_meter() at all 9 call sites.
… 1305) Pre-lease frames in run_session_with referenced a nonexistent service: meter hub-level/pre-lease sends into a throwaway WorldMetrics and post-lease isolation/policy sends via lease.service(). Route first-frame Metrics to query_session, add metrics client+server frames to the shell contract and its exhaustive test list, and rustfmt the branch. cargo check --all-targets passes; 170 targeted tests pass on the laptop.
…s-core # Conflicts: # pkgs/id/src/world_store.rs
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e0639bade
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| // Like `info`, the joined phase may read the world's metrics with | ||
| // the session's own capability. | ||
| ClientFrame::Metrics { .. } => match world.metrics().await { |
There was a problem hiding this comment.
Reauthorize the joined capability before reporting metrics
If a client joins before its capability expires and keeps the session open on an idle world, this branch continues returning metrics after expiration because world.metrics() does not validate the session token. The joined loop has no expiration timer, so authorization at join time is insufficient. Both the query-phase metrics handler and the adjacent joined-phase Info handler validate through snapshot(token), which checks capability and ancestor expiration. Revalidate the session capability here before returning the metrics snapshot.
Useful? React with 👍 / 👎.
F11.7 slice 1 — host metrics core (queue task 1305)
Implements slice 1 of #553 per the triage decomposition (queue task 1261). Slices 2 (Prometheus endpoint) and 3 (tracing spans) are follow-up queue tasks against #553.
WorldMetricsregistry (world/metrics.rs): atomic counters + fixed-bucket histograms — actor queue depth (+max), command latency, journal append latency (fsync included), checkpoint duration, frame bytes; session count supplied at snapshot time. No allocation or locking on hot paths.world_store), and every session send (send_jsonmeters frame bytes).id world statsJSON gains ametricsobject, and a capability-authorizedmetricssession frame (client + server frames added to the shell contract and its exhaustive frame tests).This resume's completion work
The branch had lapsed mid-verification with 18 compile errors:
run_session_with's pre-lease sends referenced a nonexistentservice, the first-frame match had noMetricsarm, and the shell contract lacked the new frames. Fixed by metering pre-lease/hub sends into a throwaway registry (they belong to no world), routing post-lease sends vialease.service(), routingMetricsfirst-frames to the query session, adding the contract frames, and rustfmt. Merged currentmain(one conflict inworld_store.rstests — both new tests kept).Verification (laptop, per CI-first policy local runs are on the laptop)
cargo check --all-targets— passcargo test --lib -- metrics shell_contract world_session world_store— 85 passed post-merge (170 passed across the wider targeted set pre-merge)cli::tests::test_cli_parse_world_new_and_statsstack-overflows under the default test-thread stack in this environment;cli.rsis untouched by this PR and the test passes withRUST_MIN_STACK=16777216— pre-existing stack-size sensitivity, not a regression here.Refs #553
Need help on this PR? Tag
@codesmith-botwith what you need.