Skip to content

Commit

Permalink
prometheus#2469 Best practices: Metric names
Browse files Browse the repository at this point in the history
Signed-off-by: Gopi-eng2202 <gopi.singaravelan.k@gmail.com>
  • Loading branch information
Gopi-eng2202 committed Nov 15, 2024
1 parent 7997254 commit b34b6c1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions content/docs/practices/naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ A metric name...
(for a pseudo-metric that provides [metadata](https://www.robustperception.io/exposing-the-software-version-to-prometheus) about the running binary)
* <code>data\_pipeline\_last\_record\_processed\_<b>timestamp_seconds</b></code>
(for a timestamp that tracks the time of the latest record processed in a data processing pipeline)
* ...that has a `unit` in its name, must always have that `unit` as the last word. Note that an accumulating count such as `total` will be the last word, in addition to the unit if applicable. Examples,
* <code>request\_size\_<b>bytes</b></code>
* <code>request\_size\_<b>bytes</b>_<b>total</b></code>
* <code>process\_cpu\_<b>seconds</b></code>
* <code>process\_cpu\_<b>seconds</b>_<b>total</b></code>
* ...that has a accumulating count such as `total`, can have two different naming scenarios.
* If the metric name has a unit, then the unit must be the last word before the accumulating count. Examples,
* <code>process\_cpu\_<b>seconds</b>_<b>total</b></code>
* <code>request\_size\_<b>bytes</b>_<b>total</b></code>
* If the metric name does'nt have a real unit, then the naming can follow any sorting order in a way that it fits your use case, such as `grouping similar metric names`. Examples,
* If you decided to name something as "<code>net\_conntrack\_dialer\_conn</code>", then it can have the following group names. (Note that this is only an example and you can follow your own order, if it improves your work flow)
* <code>net\_conntrack\_dialer\_conn\_total</code>
* <code>net\_conntrack\_dialer\_conn\_failed\_total</code>
* <code>net\_conntrack\_dialer\_conn\_established\_total</code>
* <code>net\_conntrack\_dialer\_conn\_closed\_total</code>
or
* <code>net\_conntrack\_dialer\_conn\_total</code>
* <code>net\_conntrack\_dialer\_conn\_total\_failed</code>
* <code>net\_conntrack\_dialer\_conn\_total\_established</code>
* <code>net\_conntrack\_dialer\_conn\_total\_closed</code>
* ...should represent the same logical thing-being-measured across all label
dimensions.
* request duration
Expand Down

0 comments on commit b34b6c1

Please sign in to comment.