Prometheus exposition format
The plain-text format a metrics page uses: one sample per line with name, optional labels in braces and a value, plus comment lines for help text and type.
In more detail
Because it is plain text, anything that can print lines can be instrumented, and any problem can be debugged by fetching the page by hand. Label values are quoted and must escape quotes, backslashes and newlines. Values are floating-point numbers, and NaN and positive or negative infinity are allowed. Each series may appear only once per page, or the scrape can be rejected.
Example
http_requests_total{method="GET",route="/healthz",status="200"} 3Related terms
- sample — One value of a time series at one moment, stored as a timestamp and a floating-point number.
- HELP and TYPE lines — The two comment lines above each metric on a metrics page: # HELP gives a human description and # TYPE declares counter, gauge, histogram or summary.
- OpenMetrics — A standardised descendant of the Prometheus text format that is stricter about types and units, ends with an end-of-file marker, and adds exemplars.
- scrape — One fetch by Prometheus of a service's metrics page over HTTP, whose values are then stored with a timestamp.
Taught in
- The Three Signals: Logs, Metrics And Traces — Full-Stack Observability: Metrics, Tracing & Logging
- Prometheus Scraping And The Pull Model — Full-Stack Observability: Metrics, Tracing & Logging
- The Prometheus Exposition Format — Full-Stack Observability: Metrics, Tracing & Logging