OpenMetrics to Join the CNCF

Navigate to:

OpenMetrics Logo

Last Friday, the Cloud Native Computing Foundation announced the acceptance of OpenMetrics, an open source metrics exposition format and evolution of the Prometheus exposition format, into the CNCF Sandbox.

The CNCF is an “open source software foundation dedicated to making cloud native computing universal and sustainable”; they provide a home and support for a variety of projects that are used for building “cloud-native” software—scalable, durable distributed systems that provide functionality over an internet connection. The first project to “graduate” from the CNCF was Kubernetes; OpenMetrics enters the foundation as a “sandbox” project, their classification for early-stage efforts.

It’s great to see this kind of effort getting support from the broader community. The Prometheus metrics exposition format has become the de facto format for pull-based metrics, so it’s nice to see the standard broken out into its own project, opening the door for additional collaboration and further integration into the broader vendor ecosystem.

The Prometheus exposition format is something we’ve supported in the TICK Stack for some time now, both in Telegraf, our collection agent, and in Kapacitor, our stream and batch processing engine.

Telegraf has the ability to both scrape and expose metrics in the Prometheus format. Here’s an example of some of Telegraf’s system metrics being exposed via the /metrics endpoint:

# HELP system_load1 Telegraf collected metric
# TYPE system_load1 gauge
system_load1{host="demo-host.local"} 2.61
# HELP system_load15 Telegraf collected metric
# TYPE system_load15 gauge
system_load15{host="demo-host.local"} 2.19
# HELP system_load5 Telegraf collected metric
# TYPE system_load5 gauge
system_load5{host="demo-host.local"} 2.23
# HELP system_n_cpus Telegraf collected metric
# TYPE system_n_cpus gauge
system_n_cpus{host="demo-host.local"} 4
# HELP system_n_users Telegraf collected metric
# TYPE system_n_users gauge
system_n_users{host="demo-host.local"} 5
# HELP system_uptime Telegraf collected metric
# TYPE system_uptime counter
system_uptime{host="demo-host.local"} 230446

Metrics exposed in the Prometheus format can be scraped by enabling the Prometheus Input Plugin, by making sure the following section is present in your config:

# Read metrics from one or many prometheus clients
[[inputs.prometheus]]
  ## An array of urls to scrape metrics from.
  urls = [
    "http://localhost:9100/metrics",
    "http://remotehost.com:9100/metrics",
    "http://192.168.1.199:9100/metrics",
  ]

  ## An array of Kubernetes services to scrape metrics from.
  # kubernetes_services = ["http://my-service-dns.my-namespace:9100/metrics"]

  ## Use bearer token for authorization
  # bearer_token = /path/to/bearer/token

  ## Specify timeout duration for slower prometheus clients (default is 3s)
  # response_timeout = "3s"

  ## Optional TLS Config
  # tls_ca = /path/to/cafile
  # tls_cert = /path/to/certfile
  # tls_key = /path/to/keyfile
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

If you need to generate a new Telegraf config for use with Prometheus, you can use the following command, adding in any additional plugins you’d like to enable, such as the system plugin, separated by a :, as follows:

$ telegraf --sample-config --input-filter prometheus:system --output-filter prometheus_client

Kapacitor can also scrape Prometheus-style endpoints. You can find more information about this functionality in the documentation for Kapacitor Scraping and Discovery.

Moving forward, InfluxData will support the OpenMetrics format as a first-class citizen and work with other open source companies and organizations to move the standard forward. So what can we expect from the future?

The best way to keep up to date on the project’s progress, and to contribute to the discussion, is via the OpenMetrics GitHub page, and specifically, the GitHub Issues. There are a number of interesting discussions going on at the moment, such as this discussion about how to version metrics.

You can read the full announcement here.