pub fn map_math(
schema: &SeriesSchema,
series: &Series,
op: MathOp,
) -> Result<Option<Series>>Expand description
Applies float math to every field of one evaluated series and drops the metric name, like
Prometheus’ simpleFloatFunc.
Transcendental functions use Rust’s platform math library. Results can differ from Prometheus for subnormals, overflow boundaries, large trigonometric inputs, and rounding-sensitive inputs.
The explicit schema and actual grid range are preserved. Fields are processed in their own chunk boundaries, without expanding to the full grid or densifying chunked samples. Missing samples stay missing; ordinary NaNs remain values. An empty or all-missing input is valid.
Eval must resolve raw staleness before calling this kernel. Evaluated samples use validity, not NaN payloads, for missingness: arithmetic can produce the reserved stale bit pattern too. Raw time axes are rejected.
Native histogram samples are skipped, as Prometheus’ math functions process only float samples: a point holding a histogram has no result in that field, and a series with no float sample left has none at all. Float-only fields keep their chunks; a field with histograms is rebuilt point by point.
Returns None for clamp with max < min, which yields no series in Prometheus.
Distinct inputs can share a label set once the name is dropped. Merging them, or failing
when both have a value at one step, is left to the caller (Prometheus
mergeSeriesWithSameLabelset).