Hi, this mailing list is for development of Prometheus and related projects. Since your question is about usage, I'm moving the thread to the prometheus-users mailing list.
To answer your question, in general a regular expression can have an unbounded number of matches, so Prometheus cannot automatically determine from the matcher alone that name2 should be there.
You can set up recording rules with all the names you expect to be there:
- record: probe_success:expected_name
expr: 1
labels:
name: name1
- record: probe_success:expected_name
expr: 1
labels:
name: name2
- record: probe_success:expected_name
expr: 1
labels:
name: name3
and then use it in the your query like
probe_success{name=~"name1|name2|name3"} or -1*probe_success:expected_name
I am using the value 1 for this metric because it is customary to do that for "metadata metrics" like this – you can multiply it with the desired value in the query like I did here.
Another thing about your query – you are matching __name__ but that is a special label representing the metric name. Since your query specifies probe_success as the metric name, the two are in conflict.
/MR