Skip to content

Conversation

@ruslanti
Copy link
Collaborator

No description provided.

@ruslanti ruslanti requested a review from Copilot November 13, 2025 15:27
@ruslanti ruslanti self-assigned this Nov 13, 2025
@ruslanti ruslanti added the enhancement New feature or request label Nov 13, 2025
Copy link
Contributor

Copilot AI left a 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, and ExtRequestStats traits for tracking different types of metrics
  • Adds StatsTimer and ExtStatsTimer for automatic duration tracking with RAII pattern
  • Refactors KeyValueStore into separate Builder and StoreImpl types to support stats injection
  • Adds plan_id field to the App configuration 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.

@ruslanti ruslanti requested a review from qrdl November 14, 2025 08:29
@ruslanti ruslanti requested review from Copilot and qrdl November 21, 2025 08:11
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +148 to +151
Ok(
default_send_request_handler(request, OutgoingRequestConfig { use_tls, ..config })
.await,
)
Copy link

Copilot AI Nov 21, 2025

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
@ruslanti ruslanti merged commit 9dd2365 into main Nov 21, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants