-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Add attribute support to the metrics IDL grammar and codegen (epic SPM-4962): set_once descriptive attributes and enumerated allowed_values attributes. This was cut from SERVER-138331 to keep the struct-codegen ticket on the minimal milestone-1 grammar subset.
Scope of Work
* Parse the attributes: block on metric leaves: type (string, int64, double, bool), set_once, allowed_values, and when (attribute-level gating, which may itself depend on the Existence and Gating tab landing first).
* set_once: the generated registration code evaluates the named parameterless symbol once, before the tree freezes at materialization, and attaches the value as a static OTel datapoint attribute.
* allowed_values: generate one enum constant per declared value (reusing the existing enums: codegen machinery) and one storage slot per attribute combination, in the same spirit as the existing pre-computed cartesian attribute tables. The record path gains the attribute argument, e.g. stats.scanned.add(n, PlanStage::kIxscan).
* The generated OTel instrument exports one datapoint per recorded combination.
* Build-time validation: cartesian-product cardinality caps, attribute type checks, and rejection of dynamic attributes (use set_once for process-constant values, or a metric family for genuinely dynamic keys).
* Extend buildscripts/idl/metrics_schema.yml and the idl_schema.yml unit tests for the new grammar.
Design source
[Technical Design: Unified Metrics Framework|$GDOC], Core Scalar Framework tab: "Attributes" section (Descriptive attributes, Enumerated attributes, Dynamic attributes, IDL Extensions).
- blocks
-
SERVER-138334 Rendering: OTel bindings and serverStatus BSON export
-
- Needs Scheduling
-
- is blocked by
-
SERVER-138331 Codegen to create metrics structs (<file>_metrics_gen.h/cpp and metrics_sections.idl)
-
- In Code Review
-
-
SERVER-138333 Registration codegen: per-file MONGO_INITIALIZER metrics registration
-
- Closed
-