Skip to main content

Module query_telemetry

Module query_telemetry 

Source
Expand description

§Per-Query Telemetry (Task 10)

Structured telemetry for every query to enable:

  • Optimization: falsifiable hypotheses about performance
  • Regression detection: automatic SLA monitoring
  • Explainability: “why was this query slow?”

§Metrics Captured

  • Routing: time, lists considered/scanned
  • Scan: codes evaluated, RAM bytes read
  • Rerank: candidates, SSD ops/bytes
  • Cache: hit ratio
  • Error: estimated ε envelope used
  • Stop: termination mode and reason

§Usage

use sochdb_vector::query_telemetry::{QueryTelemetry, TelemetryCollector};

let mut telemetry = QueryTelemetry::new("search_v1");
telemetry.record_routing(Duration::from_micros(500), 100, 16);
telemetry.record_scan(1024, 16 * 1024 * 1024);
telemetry.set_stop_reason(StopReason::BoundSatisfied);

// Emit structured telemetry
let json = telemetry.to_json();

Structs§

CacheMetrics
Cache metrics
CostSummaryJson
JSON-serializable cost summary
ErrorEnvelopeMetrics
Error envelope metrics
QueryTelemetry
Comprehensive per-query telemetry
RerankMetrics
Rerank phase metrics
RoutingMetrics
Routing phase metrics
ScanMetrics
Scan phase metrics
TelemetryAggregate
Aggregate telemetry statistics
TelemetryCollector
Thread-safe telemetry collector with aggregation
TerminationMetrics
Termination metrics

Enums§

CacheType
Cache type for hit/miss tracking