Prometheus Reserved Words

804 views
Skip to first unread message

bmcn...@redhat.com

unread,
Dec 20, 2017, 3:59:47 PM12/20/17
to Prometheus Developers
Greetings all

I have been tasked with configuring a Prometheus server and Grafana visualizations. I have been through all the docs, blogs, training discussion that I can find. Many of these docs refer to several reserved words, such as _second, -latency, _duration, etc. Is there a published list anywhere of all the key words?

Thanks for any assistance in advance!
Bill

Ben Kochie

unread,
Dec 20, 2017, 5:15:52 PM12/20/17
to bmcn...@redhat.com, Prometheus Developers
I'm not sure those are really reserved words.  We do have naming conventions for metric names.  The language syntax somewhat prevents the need for reserved words.

For example, it's totally valid to have a metric called `sum`.  And then use the `sum()` function on it.  `sum(sum)`.

Can you point to the docs that give you the impression that there are reserved words?

Metric naming is documented here:


The exposition format may also be good to be familiar with:


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/1c6f347e-e4bf-4696-bd0b-d79056937811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Pasquier

unread,
Dec 21, 2017, 3:39:00 AM12/21/17
to Ben Kochie, bmcn...@redhat.com, Prometheus Developers
The only reference to "reserved words" I know of is here:

https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels

"Label names beginning with __ are reserved for internal use."

For the rest, you're free to use whatever you want. But following the best practices naming will definitely save you some time.


On Wed, Dec 20, 2017 at 11:15 PM, Ben Kochie <sup...@gmail.com> wrote:
I'm not sure those are really reserved words.  We do have naming conventions for metric names.  The language syntax somewhat prevents the need for reserved words.

For example, it's totally valid to have a metric called `sum`.  And then use the `sum()` function on it.  `sum(sum)`.

Can you point to the docs that give you the impression that there are reserved words?

Metric naming is documented here:


The exposition format may also be good to be familiar with:

On Wed, Dec 20, 2017 at 9:59 PM, <bmcn...@redhat.com> wrote:
Greetings all

I have been tasked with configuring a Prometheus server and Grafana visualizations. I have been through all the docs, blogs, training discussion that I can find. Many of these docs refer to several reserved words, such as _second, -latency, _duration, etc. Is there a published list anywhere of all the key words?

Thanks for any assistance in advance!
Bill

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.

Julius Volz

unread,
Dec 21, 2017, 3:59:42 AM12/21/17
to Ben Kochie, bmcn...@redhat.com, Prometheus Developers
On Wed, Dec 20, 2017 at 11:15 PM, Ben Kochie <sup...@gmail.com> wrote:
I'm not sure those are really reserved words.  We do have naming conventions for metric names.  The language syntax somewhat prevents the need for reserved words.

For example, it's totally valid to have a metric called `sum`.  And then use the `sum()` function on it.  `sum(sum)`.

Actually if you just try to query for "sum", you get an error:

  parse error at char 4: unexpected end of input in aggregation, expected "("

Same for "avg", "min", "max", etc.

I'm not sure if this is intentional. Without the context of parentheses, shouldn't PromQL just try to resolve it as a metric name?
 
Can you point to the docs that give you the impression that there are reserved words?

Metric naming is documented here:


The exposition format may also be good to be familiar with:

On Wed, Dec 20, 2017 at 9:59 PM, <bmcn...@redhat.com> wrote:
Greetings all

I have been tasked with configuring a Prometheus server and Grafana visualizations. I have been through all the docs, blogs, training discussion that I can find. Many of these docs refer to several reserved words, such as _second, -latency, _duration, etc. Is there a published list anywhere of all the key words?

Thanks for any assistance in advance!
Bill

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.

Julius Volz

unread,
Dec 21, 2017, 4:01:10 AM12/21/17
to Ben Kochie, bmcn...@redhat.com, Prometheus Developers
On Thu, Dec 21, 2017 at 9:59 AM, Julius Volz <juliu...@gmail.com> wrote:
On Wed, Dec 20, 2017 at 11:15 PM, Ben Kochie <sup...@gmail.com> wrote:
I'm not sure those are really reserved words.  We do have naming conventions for metric names.  The language syntax somewhat prevents the need for reserved words.

For example, it's totally valid to have a metric called `sum`.  And then use the `sum()` function on it.  `sum(sum)`.

Actually if you just try to query for "sum", you get an error:

  parse error at char 4: unexpected end of input in aggregation, expected "("

Same for "avg", "min", "max", etc.

I'm not sure if this is intentional. Without the context of parentheses, shouldn't PromQL just try to resolve it as a metric name?

Note that this only happens for operators ("avg", "sum", ...), not functions like "rate", which are handled correctly as metric names when there isn't actually a function call happening.
 
Can you point to the docs that give you the impression that there are reserved words?

Metric naming is documented here:


The exposition format may also be good to be familiar with:


On Wed, Dec 20, 2017 at 9:59 PM, <bmcn...@redhat.com> wrote:
Greetings all

I have been tasked with configuring a Prometheus server and Grafana visualizations. I have been through all the docs, blogs, training discussion that I can find. Many of these docs refer to several reserved words, such as _second, -latency, _duration, etc. Is there a published list anywhere of all the key words?

Thanks for any assistance in advance!
Bill

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/1c6f347e-e4bf-4696-bd0b-d79056937811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.

Brian Brazil

unread,
Dec 21, 2017, 4:16:14 AM12/21/17
to Julius Volz, Ben Kochie, bmcn...@redhat.com, Prometheus Developers
On 21 December 2017 at 09:01, Julius Volz <juliu...@gmail.com> wrote:
On Thu, Dec 21, 2017 at 9:59 AM, Julius Volz <juliu...@gmail.com> wrote:
On Wed, Dec 20, 2017 at 11:15 PM, Ben Kochie <sup...@gmail.com> wrote:
I'm not sure those are really reserved words.  We do have naming conventions for metric names.  The language syntax somewhat prevents the need for reserved words.

For example, it's totally valid to have a metric called `sum`.  And then use the `sum()` function on it.  `sum(sum)`.

Actually if you just try to query for "sum", you get an error:

  parse error at char 4: unexpected end of input in aggregation, expected "("

Same for "avg", "min", "max", etc.

I'm not sure if this is intentional. Without the context of parentheses, shouldn't PromQL just try to resolve it as a metric name?

Note that this only happens for operators ("avg", "sum", ...), not functions like "rate", which are handled correctly as metric names when there isn't actually a function call happening.


The last time this came up I believe we said that it's not really a problem in practice as that's a bad metric name in general, and you can always use {__name__="sum"}.

Brian
 
 
Can you point to the docs that give you the impression that there are reserved words?

Metric naming is documented here:


The exposition format may also be good to be familiar with:


On Wed, Dec 20, 2017 at 9:59 PM, <bmcn...@redhat.com> wrote:
Greetings all

I have been tasked with configuring a Prometheus server and Grafana visualizations. I have been through all the docs, blogs, training discussion that I can find. Many of these docs refer to several reserved words, such as _second, -latency, _duration, etc. Is there a published list anywhere of all the key words?

Thanks for any assistance in advance!
Bill

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/1c6f347e-e4bf-4696-bd0b-d79056937811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CABbyFmpGYwOS3neyLNzx3rRzOiyR9FQ4szsn7jPnsLGZiui0eg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.

To post to this group, send email to prometheus-developers@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages