Skip to main content

binary_keeps_metric_name

Function binary_keeps_metric_name 

Source
fn binary_keeps_metric_name(
    op: &TokenType,
    modifier: Option<&BinModifier>,
) -> bool
Expand description

Whether the metric name survives a binary operation; see binary_metric_name_side for the operand that supplies it.

Follows Prometheus’ shouldDropMetricName and resultMetric: set operators and comparisons keep the name, while arithmetic operators drop it. A comparison also drops it when it returns a bool or is a one-to-one on(...) match that does not keep __name__ or an ignoring(...) match that excludes it. Prometheus keeps only the on(...) labels or deletes the ignoring(...) labels for one-to-one matches.