pub struct MetricSpec {
pub value: String,
pub family: Option<String>,
pub kind: Option<MetricKind>,
pub unit: Option<String>,
pub format: Option<String>,
pub cell: BTreeMap<String, String>,
}Expand description
SRD-40b §1 schema for one synthetic-metric declaration on an op template.
Fields§
§value: StringRequired. A Polydat expression evaluated in the op’s bound
scope. A bare binding name is the canonical form when
the formula belongs in a bindings: block; any GK
expression that produces a numeric result is also
valid. See SRD-40b §4.
family: Option<String>Optional override of the family name. Defaults to the
map key on ParsedOp.metrics. SRD-40b §1.
kind: Option<MetricKind>Optional metric type. Defaults to Gauge per SRD-40b §1.
unit: Option<String>Optional OpenMetrics unit suffix (ms, bytes, …).
When set, lands in BOTH the family-name suffix and the
metric_family.unit column per SRD-40a §4.3.
format: Option<String>Optional generation-time numeric sanitiser using
Excel-style hash patterns (#.##, 0.000, etc.).
Translated at registration time into a round op that
runs before the value is recorded on the instrument;
storage holds the sanitised number. SRD-40b §1.
cell: BTreeMap<String, String>Optional dimensional placement: dimension name → a Polydat expression producing that dimension’s value for this sample.
A metric identity is its label set with the family name promoted
into it, a closed 1:1 association. cell: therefore does not
attach a label to a sample — it selects the dimensional CELL the
sample belongs to, REFINING the identity its registration site
already composes. One value per cell, one family per cell, and the
existing duplicate-family check keeps working unchanged.
BTreeMap so synthesis order is deterministic: the coordinate’s
rendering is what keys a cell, and a map that iterated differently
between runs would key the same coordinate two ways.