Remember that by default, an expression like

    foo * bar

will only produce outputs for timeseries where both foo and bar have 
exactly the same set of labels.  So you can filter on one side only:

    foo{namespace="xxx"} * bar

This gives the same result as:

    foo{namespace="xxx"} * bar{namespace="xxx"}

and is shorter than your proposed

    with_labels(namespace="xxx") (foo * bar)

You can also introduce a synthetic timeseries which always has value 1 to 
do this (or 0, with + operator).  This allows other tricks like copying 
labels from this timeseries into the result timeseries.

https://www.robustperception.io/how-to-have-labels-for-machine-roles
https://www.robustperception.io/exposing-the-software-version-to-prometheus
https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches

-- 
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/5bffc59e-6bfc-4d35-8e6e-319ef004d59d%40googlegroups.com.

Reply via email to