PromQL aggregator removes the __name__ label

I have 6 Prometheus series with a label called report_date which changes every day. So on a time series graph, each day looks like a separate series. (In this screenshot, I’m looking at 5 days so there are 30 series.) I want to ignore that label so the graph shows 6 lines instead. I tried min without(report_date) ({__name__=~"qalif_color_primary_.+_[x|y]"}). The regex works, and report_date is removed, but it also removes the __name__ label. Why?

This is a problem because I’m trying to use {{__name__}} as the legend.

As a workaround, I can make 6 separate queries and set the legend manually. But this requires more effort and I’m curious why the above option doesn’t work.

I’m using Grafana Cloud.

Hi, I think that’s a default PromQL feature. In VictoriaMetrics there’s a special parameter to keep the names (which also somewhat explain why it’s dropped). What you could do is to explicitly set the grouping, that you want to get the name. So you wouldn’t use min without(report_date) (…) but min by(__name__) (…) (or add every label to by clausule. This should work.

Thanks! Your suggestion works.

1 Like