Prometheus metric syntax: Difference between revisions

From wikinotes
Line 21: Line 21:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# regular comment
# regular comment               // possibly invalid?


# HELP metric_name  Does thing  // description of metric
# HELP metric_name  Does thing  // description of metric

Revision as of 16:58, 1 October 2022

Syntax used to expose metrics to prometheus.

Documentation

official docs https://prometheus.io/docs/instrumenting/exposition_formats/
text-based https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-details
metric types https://prometheus.io/docs/concepts/metric_types/

Comments

In addition to regular comments, doc-comments exist for

  • HELP describing metrics
  • TYPE describing metric type
# regular comment               // possibly invalid?

# HELP metric_name  Does thing  // description of metric
# TYPE metric_name  counter     // counter, gauge, historgram

Metrics

my_metric 1.2

my_metric{hostname="foobar", user="baz"}  1.2