-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Turn the POC observability:: metric primitives into production C++ types for the unified metrics framework (epic SPM-4962).
Scope of Work
* Productionize Counter, UpDownCounter, Gauge, HighWaterMark, AtomicHistogram, and Histogram.
* AtomicHistogram: lock-free fetch_add accumulator that snapshots {{
}}; concurrent counts are approximate; values above the last bucket boundary saturate into the top bucket. Prefer this variant by default.
* Histogram: non-lock-free variant synchronized by the owner with exact counts, for use when recording already happens under a lock.
* Support the optional leaf option: absent from render/export until first written; any add(), set(), or observe() marks it written, even with zero.
* Support the cache_exclusive leaf option: pad to its own cache line to prevent false sharing on hot counters.
* Non-scalar value leaves via synchronized_value, safe for concurrent updates.
* All storage atomic, relaxed ordering on record and render. Structs are safe for concurrent record from any thread and for concurrent render; torn multi-field snapshots are allowed, and owners needing consistent multi-field reads use the poll-and-snapshot pattern.
* HighWaterMark: setToMax plus a reset capability (reset to current value, with a built-in option for resetting after a certain amount of time).
* Add unit tests for each primitive asserting behavior matches the legacy implementations.
Design source
[Technical Design: Unified Metrics Framework|$GDOC], Core Scalar Framework tab: "Metric primitives", "Extensions to leaves", "IDL Extensions"; Overview tab: "Test Plan". Much of this has already been POC'd (see the GDoc link).
Out of scope
* GatedCounter and startup gate semantics are deferred to the gating milestone.
- blocks
-
SERVER-138331 Codegen to create metrics structs (<file>_metrics_gen.h/cpp and metrics_sections.idl)
-
- In Code Review
-