Skip to main content

grouped_output_tags

Function grouped_output_tags 

Source
fn grouped_output_tags(
    input: &NativeNode,
    op: &BoundAggregate,
    source_tags: &[Vec<String>],
) -> Option<Vec<String>>
Expand description

The labels an aggregate reports: the ones its grouping keeps among those its input carries.

by(...) keeps exactly the labels it names, and without(...) keeps the rest and drops the metric name, as Prometheus does. A grouping by __name__ keeps the name where the input reports one; a named scan only reports it among the runtime labels, so the aggregate keeps it there and publishes no column for it, which is what sum by (__name__) over one metric reports.

Both the fold that binds its argument and the one that reads it per point answer this way: what decides the columns is the grouping, not where the aggregate’s one argument comes from.