Thanks for response but it is not exactly what I'm looking for. For simple
cases where you don't have aggregation functions it works, but show me how
to use it in expression like this
sum(up{job="node_exporter", fqdn=~"n.*"})/sum(up{job="node_exporter"})
and this expression is only using 2 metrics.
Sure we can multiply every single metric by some synthetic timeseries - but
this will create even bigger mess that just adding labels
On Thursday, April 23, 2020 at 1:36:33 PM UTC+2, Brian Candler wrote:
>
> 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/2f5344aa-6c59-4ca0-ba54-c2f94a296387%40googlegroups.com.