Labels as additional text info

27 views
Skip to first unread message

fiala...@gmail.com

unread,
Nov 4, 2020, 3:42:34 AM11/4/20
to Prometheus Users
Hi,

I have a question about labels in metrics. Is it suitable to add additional data to label?

I want to report alerts about autonomous systems that has number and name (for example: AS2914  NTT America Inc. A want to include both in text message of alert.

There are two different approches:
1. one label with AS number
- pros: Don't need to edit exporter when I want to change data in text message
- cons: I have to make an API request to get AS name. It could be issue durring large outage -> I have to do lots of API requests

2. two labels - AS number and AS name
- pros: I can create whole incident message from labels without additional API call
- cons: Store more data in prometheus

What is a good practice?

Thank you.

Brian Candler

unread,
Nov 4, 2020, 8:42:20 AM11/4/20
to Prometheus Users
As long as the labels aren't changing, it doesn't store any more data in Prometheus.  Each unique combination of labels represents a distinct timeseries, but the bag of labels is only stored once (I think the timeseries is identified by an integer ID internally)

Ben Kochie

unread,
Nov 4, 2020, 8:50:44 AM11/4/20
to Brian Candler, Prometheus Users
Two labels does create two indexes, but I don't think the overhead would be that bad.

Another option is to store both values in one label.

as="AS2914;NTT America Inc"

By using the semicolon separator, you can use regexp matching or label_replace() to do some slice-n-dice dynamically.

On Wed, Nov 4, 2020 at 2:42 PM Brian Candler <b.ca...@pobox.com> wrote:
As long as the labels aren't changing, it doesn't store any more data in Prometheus.  Each unique combination of labels represents a distinct timeseries, but the bag of labels is only stored once (I think the timeseries is identified by an integer ID internally)

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/9f8bfe1b-d0cd-4501-8450-248978bfeb5co%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages