list of values for a label

37 views
Skip to first unread message

Prabhudev Hosur

unread,
Feb 27, 2025, 5:11:35 AM2/27/25
to Prometheus Users
Hello, 
I have the following questions and requesting your help in answering them.

(a) Does prometheus support array as a value for label?
For example, channel_id: [100, 200, 300]

(b) Suppose we are sending metric channel_status for each streaming channel  with sample value of 1 if it is up and value of 0 if it is down. The metric has a label, channel_id: <channel id>
We would like to create a recording rule to generate a new metric, called channel_down. For this, we would like to check periodically if channel_status =0 for any channel  among all channels, and write a single channel_down metric sample with label channel_id that has the value as a list of channel ids which correspond to all the channels that are down.

I wonder how recording rule can dynamically assign values to the label.  I need your help here please.

Than you

Bryan Boreham

unread,
Feb 27, 2025, 5:36:30 AM2/27/25
to Prometheus Users
>  (a) Does prometheus support array as a value for label?

No.  The data model is described at https://prometheus.io/docs/concepts/data_model/, although it could perhaps be more clear that label values are strings.
You are free to encode anything you like as a string.

> (b)  ... with label channel_id that has the value as a list of channel ids ...

Sorry, Prometheus does not have this feature.

Prabhudev Hosur

unread,
Feb 27, 2025, 11:13:53 AM2/27/25
to Prometheus Users
Thank you.  I think you answered my questions.
Reply all
Reply to author
Forward
0 new messages