Skip to main content

Module metrics_store

Module metrics_store 

Source
Expand description

Three-tier in-memory ring buffer for per-service metrics.

Each service gets three retention tiers:

  • Tier 0: 1-min granularity, 15 samples (15 min window)
  • Tier 1: 15-min granularity, 16 samples (4 h window)
  • Tier 2: 4-hour granularity, 18 samples (72 h window)

A background sampler task reads atomic counters once per minute and pushes samples into tier 0. Rollups cascade automatically.

Structsยง

MetricSample
One sample point for a single service.
MetricsStore
Top-level per-service metrics store, keyed by service type (ResourceType as i32).
ServiceCounters
Atomic counters that services increment in their hot paths.