2.3 KiB
2.3 KiB
pg1-instrumented-metrics: QA Plan
Unit Tests
histogram.rs (T1)
percentile_empty_returns_none-- percentile on empty histogram returns Nonepercentile_single_observation-- single obs returns correct percentilepercentile_known_distribution-- 3 observations, verify p50/p99 match expectedpercentile_beyond_all_bounds-- observation above max bound still trackedtotal_count_tracks_observations-- total_count increments correctlyrender_percentile_gauges_empty-- empty histogram produces empty stringrender_percentile_gauges_format-- gauges contain correct metric names and values
metrics/mod.rs (T2, T3, T6)
user_signal_timestamp_map_record_get-- record and retrieve a timestampuser_signal_timestamp_map_eviction-- map evicts when over capacityuser_signal_timestamp_map_cap_respected-- map never exceeds caprender_diagnostics_valid_json-- render_diagnostics returns parseable JSONsignal_writes_by_type_increment-- per-type counter increments correctly
Integration Tests
pg1_instrumented_metrics.rs (T7)
prometheus_contains_percentile_gauges-- /metrics output includes p50/p95/p99 gauge lines for signal write, retrieve, and search latenciesprometheus_contains_per_type_counters-- /metrics output includestidaldb_signal_writes_by_type{signal_type="view"}after writing view signalsprometheus_contains_staleness_histogram-- /metrics output includestidaldb_personalization_staleness_usafter user querydiagnostics_endpoint_returns_json-- /diagnostics returns HTTP 200 with valid JSON containing expected keys
Non-Functional Verification
- All new code is behind
#[cfg(feature = "metrics")]-- verifycargo checkpasses without the feature flag - No new dependencies added to Cargo.toml
- Existing test suite (1345 lib tests) still passes after changes
Exit Criteria
- All unit tests pass:
cargo test --manifest-path tidal/Cargo.toml --lib --features metrics - Integration test passes:
cargo test --manifest-path tidal/Cargo.toml --test pg1_instrumented_metrics --features metrics,test-utils - No regressions: full lib test suite passes
- Clippy clean:
cargo clippy --manifest-path tidal/Cargo.toml -- -D warnings - Format clean:
cargo fmt --manifest-path tidal/Cargo.toml --check