Thanks a lot Brian, it worked On Tuesday, 21 March 2023 at 22:43:34 UTC+5:30 Brian Candler wrote:
> See: > 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 > > Assuming there are one or more instances of metric1 with label {foo="1"} > and exactly one instance of metric2 with label {foo="1"}, then you can do: > metric1 * on (foo) group_left (bar) metric2 > > (I think that's right). metric1 is the "many" side and metric2 is the > "one" side. We can copy label bar from the "one" side to the "many" side. > > On Tuesday, 21 March 2023 at 13:23:49 UTC Kishore Chopne wrote: > >> Hi, >> If we have metric1{foo="1} and metric2{foo="1",bar="2"} ? How can I >> copy the labels from metric2 to metric1? How can I create recording rules >> so that the new metrics can be sent to Prometheus. >> The idea is to enrich some metrics with more labels. >> >> Thanks. >> /Kishore >> > -- 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/a0d457b8-dccb-42bb-afd0-caa85f93238fn%40googlegroups.com.

