I think you can do that by merging two instant vectors:
(container_cpu_usage_seconds_total{container="prometheus", cluster="abc"} or container_cpu_usage_seconds_total{container="prometheus", environment=~"xyz"})
A missing label also matches as if it were empty string. So if your metrics have *either* cluster *or* environment label (but not neither or both), you could do this:
container_cpu_usage_seconds_total{container="prometheus", cluster=~"abc|",environment=~"xyz|"}
And there is really horrible stuff you can do with
label_join() or label_replace().
But if you need to do any of those tricks, then something isn't right. You should consider:
- making your labels consistent, such that filtering on just cluster or just environment gives you what you need
- whether there's a better way to label your metrics, e.g. add a new common label dimension (either statically or via relabelling);
- whether you should merge the results elsewhere, e.g. in your dashboard software