-
Notifications
You must be signed in to change notification settings - Fork 0
new fields to stats #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new fields to stats #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the statistics tracking system by introducing new traits and builders for managing stats collection across HTTP services, key-value stores, and backend requests. The changes replace the previous feature-gated StatRow approach with a more modular trait-based design.
Key changes:
- Introduces
StatsVisitor,ReadStats,UserDiagStats, andExtRequestStatstraits for tracking different types of metrics - Adds
StatsTimerandExtStatsTimerfor automatic duration tracking with RAII pattern - Refactors
KeyValueStoreinto separateBuilderandStoreImpltypes to support stats injection - Adds
plan_idfield to theAppconfiguration struct
Reviewed Changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.rs | Adds StatsStub import and plan_id field initialization; updates HttpService type signature |
| src/key_value.rs | Updates get_store signature to accept ReadStats parameter |
| src/executor.rs | Removes callback pattern in favor of StatsVisitor trait usage |
| src/context.rs | Implements StatsStub with all required stats traits; removes old StatsWriter implementation |
| crates/utils/src/lib.rs | Creates new utils crate with UserDiagStats trait and Utils struct |
| crates/runtime/src/util/stats.rs | Complete rewrite introducing stats traits, timer types, and comprehensive test coverage |
| crates/runtime/src/store.rs | Adds HasStats trait and updates builder to require stats capability |
| crates/runtime/src/lib.rs | Integrates stats system throughout runtime, adds Utils to Data struct |
| crates/runtime/src/app.rs | Adds plan_id field to App struct |
| crates/runtime/Cargo.toml | Removes clickhouse dependency and stats feature flag |
| crates/reactor/wit | Updates subproject commit reference |
| crates/key-value-store/src/lib.rs | Splits into Builder and StoreImpl to support stats injection; adds extensive tests |
| crates/key-value-store/Cargo.toml | Adds tokio dev-dependency for testing |
| crates/http-service/src/state.rs | Adds stats field to HttpState and implements HasStats trait |
| crates/http-service/src/lib.rs | Updates service to use stats traits instead of callback pattern |
| crates/http-service/src/executor/wasi_http.rs | Replaces manual timing with StatsTimer; removes status code channel pattern |
| crates/http-service/src/executor/mod.rs | Updates executor trait to accept StatsVisitor instead of callback |
| crates/http-service/src/executor/http.rs | Adopts StatsTimer for automatic duration tracking |
| crates/http-service/Cargo.toml | Removes bytesize dependency and stats feature |
| crates/http-backend/src/stats.rs | New file implementing ExtStatsTimer for backend request timing |
| crates/http-backend/src/lib.rs | Adds external request stats tracking to backend |
| crates/dictionary/Cargo.toml | Renames package from dictionary to utils |
| Cargo.toml | Updates workspace dependency reference from dictionary to utils |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 23 out of 25 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Ok( | ||
| default_send_request_handler(request, OutgoingRequestConfig { use_tls, ..config }) | ||
| .await, | ||
| ) |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 147 states 'keep timer alive until request is done', but the timer is dropped at the end of the spawned async block (line 152), not when the request completes. The timer will only measure the time of the spawn operation, not the actual request duration. Consider moving the timer drop to after the request handler completes or clarifying the comment.
| Ok( | |
| default_send_request_handler(request, OutgoingRequestConfig { use_tls, ..config }) | |
| .await, | |
| ) | |
| let result = default_send_request_handler(request, OutgoingRequestConfig { use_tls, ..config }).await; | |
| Ok(result) |
No description provided.