label_join() and label_replace()

These functions are used to manipulate labels—they allow you to join labels to other ones, extract parts of label values, and even drop labels (though that particular operation is easier and more ergonomic to do with standard aggregation operators). In both functions, if the defined target label is a new one, it will get added to the label set; if it's an existing label, it will get replaced.

When using label_join, you're required to provide an instant vector, define a resulting label, identify the separator of the resulting concatenation, and establish the labels to join, as exemplified in the following syntax:

label_join(<vector>, <resulting_label>, <separator>, source_label1, source_labelN)

For example, ...

Get Hands-On Infrastructure Monitoring with Prometheus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.