I want to select all metrics that don't have label "container". Is there any possibility to do that with prometheus query?
Asked
Active
Viewed 2.8k times
3 Answers
39
Try this:
{__name__=~".+",container=""}
There needs to be at least one non-empty matcher (hence the +
in the __name__
regular expression, *
wouldn't cut it). And the way you query for a missing label is by checking for equality with the empty string.

Alin Sînpălean
- 8,774
- 1
- 25
- 29
10
In recent versions of Prometheus it's enought to query for something like this:
node_load1{not_existent_label=""}

Jean-François Fabre
- 137,073
- 23
- 153
- 219

Konstantin
- 126
- 1
- 2
5
You can also try checking if the label is or isn’t equal to the empty string.
metric_name{label_name=""}
Or, try label data integrity checks form deepchecks
All the best!

CodyMonto89
- 51
- 1
- 1