Prometheus metric syntax: Difference between revisions
From wikinotes
(Created page with "Syntax used to expose metrics to prometheus. = Documentation = <blockquote> {| class="wikitable" |- | official docs || https://prometheus.io/docs/instrumenting/exposition_formats/ |- |} </blockquote><!-- Documentation -->") |
No edit summary |
||
Line 7: | Line 7: | ||
| official docs || https://prometheus.io/docs/instrumenting/exposition_formats/ | | official docs || https://prometheus.io/docs/instrumenting/exposition_formats/ | ||
|- | |- | ||
| text-based || https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-details | |||
|} | |} | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> | ||
= Comments = | |||
<blockquote> | |||
In addition to regular comments, doc-comments exist for | |||
* <code>HELP</code> describing metrics | |||
* <code>TYPE</code> describing metric type | |||
<syntaxhighlight lang="bash"> | |||
# regular comment | |||
# HELP metric_name A description of the metric. | |||
# TYPE metric_name counter | |||
</syntaxhighlight> | |||
</blockquote><!-- Comments --> | |||
= Metrics = | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
my_metric 1.2 | |||
my_metric{hostname="foobar", user="baz"} 1.2.3 | |||
</syntaxhighlight> | |||
</blockquote><!-- Metrics --> |
Revision as of 16:42, 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
Comments
In addition to regular comments, doc-comments exist for
HELP
describing metricsTYPE
describing metric type# regular comment # HELP metric_name A description of the metric. # TYPE metric_name counter
Metrics
my_metric 1.2 my_metric{hostname="foobar", user="baz"} 1.2.3