Should use Names or IDs as label values?

29 views
Skip to first unread message

Srihari Jonnalagadda

unread,
Jun 7, 2020, 8:59:19 AM6/7/20
to Prometheus Users
Hi. I’m quite new to Prometheus. I want to store metrics based on an 'ID' property (name can be editable) but wish to provide user a friendly name of the respective entity in the dashboard. e.g. You track metrics by department with an internal Department ID but wish to use the department name in the dashboard showing department metrics. Should we map ID -> Name outside prometheus after querying?

Thanks in advance and stay safe!

Ben Kochie

unread,
Jun 7, 2020, 9:28:20 AM6/7/20
to Srihari Jonnalagadda, Prometheus Users
It's completely fine to use names in label values. `department="Some Nice People"` is a completely normal and valid thing to do.

On Sun, Jun 7, 2020 at 2:59 PM Srihari Jonnalagadda <srihari.jo...@hyscale.io> wrote:
Hi. I’m quite new to Prometheus. I want to store metrics based on an 'ID' property (name can be editable) but wish to provide user a friendly name of the respective entity in the dashboard. e.g. You track metrics by department with an internal Department ID but wish to use the department name in the dashboard showing department metrics. Should we map ID -> Name outside prometheus after querying?

Thanks in advance and stay safe!
--


*This mail contains confidential information intended only for the
individual(s) named. If you’re not the named addressee, don’t disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
delete it from your system.If you wish not to receive such e-mails you may
reply with text “Unsubscribe”.*







--
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/c99a5d06-8b8f-479a-9315-e2d3296978cfo%40googlegroups.com.

Srihari Jonnalagadda

unread,
Jun 7, 2020, 9:33:02 AM6/7/20
to Prometheus Users
Thanks for the prompt reply. Does that mean we shouldn’t be modifying dept name once it has been created. what if we have department name editable?

Ben Kochie

unread,
Jun 7, 2020, 9:45:04 AM6/7/20
to Srihari Jonnalagadda, Prometheus Users
This will create new time-series. Allowing edits is up to you.

Typically, metrics are identified by service discovery.

I recommend reading the instrumentation and naming best practices guides in the Prometheus documentation.


On Sun, Jun 7, 2020 at 3:33 PM Srihari Jonnalagadda <srihari.jo...@hyscale.io> wrote:
Thanks for the prompt reply. Does that mean we shouldn’t be modifying dept name once it has been created. what if we have department name editable?
--


*This mail contains confidential information intended only for the
individual(s) named. If you’re not the named addressee, don’t disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
delete it from your system.If you wish not to receive such e-mails you may
reply with text “Unsubscribe”.*







--
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.

Srihari Jonnalagadda

unread,
Jun 7, 2020, 9:54:31 AM6/7/20
to Prometheus Users
Ya It creates a new time series. I don’t want to split up the data. So thats the reason I have chosen the ID(dept-1) instead of name(Some Nice People) as a label value. But then stuck with this question “how to provide user friendly name(Some Nice People) in the query responses?”

Brian Candler

unread,
Jun 7, 2020, 10:00:10 AM6/7/20
to Prometheus Users
On Sunday, 7 June 2020 14:54:31 UTC+1, Srihari Jonnalagadda wrote:
Ya It creates a new time series. I don’t want to split up the data. So thats the reason I have chosen the ID(dept-1) instead of name(Some Nice People) as a label value. But then stuck with this question “how to provide user friendly name(Some Nice People) in the query responses?”

Srihari Jonnalagadda

unread,
Jun 7, 2020, 10:07:26 AM6/7/20
to Prometheus Users
Ya. Had a look at these. This makes queries more complex. That is why I just want to confirm if I’m going the wrong way and wanted to know the recommended approach if any. Also want to check what people prefer names or IDs.
Reply all
Reply to author
Forward
0 new messages