Sure, both LHS and RHS there return an unnamed timeseries with no labels.
Are you aiming to do something like this?
sum(up{job="node_exporter", fqdn=~"n.*", namespace="foo"}) /
sum(up{job="node_exporter", namespace="foo"})
You can get sum() to return results with labels, using sum by:
sum by (namespace,job) (up{job="node_exporter", namespace="foo",
fqdn=~"n.*"}) / sum by (namespace, job) (up)
I agree it's not shorter, and it depends on PromQL engine optimisations if
it's going to be equally efficient, but it does at least move the logical
conditions into one place.
It does let you get the results for all namespaces at once if you want:
sum by (namespace,job) (up{job="node_exporter", fqdn=~"n.*"}) / sum by
(namespace, job) (up)
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/c047af3c-1d2b-4cd5-b03a-b5bf85f40049%40googlegroups.com.