Expose same metric name and different label within one time

666 views
Skip to first unread message

weiji...@gmail.com

unread,
Jul 25, 2017, 11:50:50 PM7/25/17
to Prometheus Users
hi,

I'm newbie of prometheus and I want to is there any way to implement below?

Currently, I want to expose 2 metric with same name but different labels at one time, which look like below:

# HELP system_test_count help description
# TYPE system_test_count gauge
system_test_count{label="test1",} 1.0

............

# HELP system_test_count help description
# TYPE system_test_count gauge
system_test_count{label="test2",} 1.0

But from prometheus targets page, I got below errors:

text format parsing error in line xx: second HELP line for metric name "system_test_count"
May I ask is there any approach to implement this?
And I don't want to add some other extra info into the metric name(e.g. system_test_A_count & system_test_B_count)

Thanks
Nick

Nicholas Capo

unread,
Jul 25, 2017, 11:59:42 PM7/25/17
to weiji...@gmail.com, Prometheus Users
You are only allowed to have one `HELP` line per metric name.

So instead of:

> # HELP system_test_count help description
> # TYPE system_test_count gauge
> system_test_count{label="test1",} 1.0
> ... 
> # HELP system_test_count help description
> # TYPE system_test_count gauge
> system_test_count{label="test2",} 1.0

Change it to :

> # HELP system_test_count help description
> # TYPE system_test_count gauge
> system_test_count{label="test1",} 1.0
> ...
> system_test_count{label="test2",} 1.0

I would recommend using a client library [0] to avoid problems like this.

Nicholas


--
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 post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4c98149c-565f-483c-a5c7-e5bf48e6fb76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages