What is OpenMetrics, and how does it differ from the classic Prometheus text format?
AdvancedConceptKubernetes Monitoring, Scale & Cloud
Answer
OpenMetrics is the CNCF standardisation of the Prometheus exposition format. Differences that matter:
- Content type
application/openmetrics-text; version=1.0.0. - The payload must end with
# EOF. - Counter samples must end in
_total; a_createdseries may expose the counter's creation time. - Exemplars are only supported in OpenMetrics:
http_requests_total{code="200"} 1027 # {trace_id="4bf92f3577b34da6"} 1 1731100000.123 - Adds
unit,infoandstatesetmetric types. - Timestamps are in seconds (classic format uses milliseconds).
Prometheus negotiates the format through the Accept header; in Prometheus 3.x you control the order with scrape_protocols (e.g. [OpenMetricsText1.0.0, PrometheusProto, PrometheusText0.0.4]). Exemplar storage also needs --enable-feature=exemplar-storage.
More on Kubernetes Monitoring, Scale & Cloud
What is kube-prometheus-stack and what does it install?BeginnerWhat CRDs does the Prometheus Operator provide?IntermediateHow does the Prometheus Operator decide which ServiceMonitors to load?IntermediateWhich cAdvisor container memory metric should you watch, and why?IntermediateHow do metrics-server and the custom/external metrics APIs relate to HPA?IntermediateWhich kube-state-metrics metrics do you use most?Beginner