OpenMetrics
By CNCF
OpenMetrics is a specification for a text-based metrics exposition format that standardizes how applications expose numeric telemetry, such as counters, gauges, and histograms, for collection by monitoring systems. It formalizes and…
Definition
OpenMetrics is a specification for a text-based metrics exposition format that standardizes how applications expose numeric telemetry, such as counters, gauges, and histograms, for collection by monitoring systems. It formalizes and extends the exposition format originally popularized by Prometheus, giving vendors and open-source projects a common, IETF-track standard to target instead of each defining a proprietary metrics format. Any system that exposes an OpenMetrics-compliant endpoint can be scraped by any compatible collector.
Overview
Before OpenMetrics, the de facto standard for exposing application metrics was the plain-text format Prometheus introduced with its client libraries. Many other tools copied that format because it was simple and widely supported, but it was never formally specified outside Prometheus's own documentation, which created ambiguity about edge cases like how to represent metric types, timestamps, or special float values such as infinity and not-a-number. OpenMetrics was created to turn that de facto convention into a rigorously defined, vendor-neutral specification suitable for standards bodies and long-term interoperability. Mechanically, an OpenMetrics endpoint is an HTTP resource that responds with a specific content type and a plain-text body listing each metric as one or more lines: a metric name, an optional set of label key-value pairs in curly braces, a numeric value, and an optional timestamp. Metrics are typed as counters, gauges, histograms, summaries, or untyped, and the format specifies exactly how each type must be serialized, including required suffixes for histogram buckets and rules for representing cumulative versus instantaneous values. A collector fetches this endpoint on a schedule, called scraping, and stores the parsed samples in a time-series database. OpenMetrics sits directly downstream of Prometheus's exposition format, formalizing it as a standard rather than inventing something new, and it is compatible enough that most Prometheus exporters can be treated as OpenMetrics-compliant with minor adjustments. It differs from push-based protocols like StatsD, which send individual metric updates over UDP as events occur, whereas OpenMetrics is inherently pull-based, requiring a collector to periodically request the current state from the target. In practice, OpenMetrics is the format nearly every modern application, exporter, and sidecar produces so that it can be scraped by Prometheus, Thanos, VictoriaMetrics, or other compatible time-series databases. Cloud-native software commonly ships a `/metrics` endpoint conforming to this format out of the box, and Kubernetes components, service meshes, and language runtimes widely support it, making it the common denominator for cloud-native observability stacks. The format's main limitation is that it is optimized for pull-based, dimensional metrics and is not well suited to environments where a lightweight client cannot run an HTTP server or where extremely high-frequency event-level data needs to be pushed rather than polled; those cases are better served by StatsD or a push gateway that batches pushed metrics for later scraping. It also does not address tracing or logging, so teams typically pair it with a tracing standard like OpenTelemetry to get full observability coverage. Adopting OpenMetrics does not by itself guarantee compatibility across every collector, since some tools still expect the looser, original Prometheus format rather than the stricter subset OpenMetrics defines, so teams validating a new exporter should check both against their intended backend before relying on it in production.
Specification
- Formal, vendor-neutral specification for a text-based metrics exposition format
- Standardizes counters, gauges, histograms, and summaries as explicit metric types
- Pull-based model where collectors scrape an HTTP metrics endpoint
- Backward compatible with the original Prometheus exposition format
- Defines precise rules for labels, timestamps, and special float values
- Adopted widely across Kubernetes and cloud-native exporters
- On an IETF standards track for long-term interoperability
- Content-negotiated over HTTP with a dedicated media type