Help build the future of open source observability software Open positions

Check out the open source projects we support Downloads

Grot cannot remember your choice unless you click the consent notice at the bottom.

How we made working with Prometheus easier with metric metadata in Grafana’s Explore view

How we made working with Prometheus easier with metric metadata in Grafana’s Explore view

15 Jun, 2020 2 min

At Grafana Labs, we’re all big fans of the Prometheus and Grafana combination. To an extent, we just won’t shut up about it.

We strongly believe in simplicity and think you shouldn’t need any extra effort to understand the metrics of your service(s) holistically. Yet we’ve all been in that situation where it is challenging to fully grasp what the metrics of our service(s) are and what they do. While naming conventions exist, at times they are not followed or enforced.

Let me be the bearer of the good news of how we’ve made working with Prometheus easier. Since Prometheus v2.15+ and Grafana v6.6+, you now get metric metadata directly in Grafana’s Explore view. Also, Cortex v1.1+ supports this too, if you pair it with our shiny new Grafana Agent.

Metric metadata in Explore
Metric metadata in Explore

More than once, I’ve seen Gauges with highly monotonic increases that could pose as Counters, or asked myself “Why are these metric names so similar? What is the difference between them?” Each time, I needed to look at the definition of the metric, typically in-code, to answer my questions. Given my low attention span, I find this approach highly disruptive to my workflow. This feature is designed to solve these common pain points.

As you type in the name of a metric, the AutoComplete panel now shows the metric metadata. This includes:

  • The Type. No more guessing on when you should apply rate to this function.
  • The Help. No more ambiguity on what this metric does.
  • The Unit. No more _seconds suffixes.

It’s worth noting that the ability to find metadata from Prometheus has always been there via the Scrape Targets Metadata API endpoint; however, it generally gives you more than you need – making the information harder to find, as it is per scrape target. The truth is, more often than not, our users don’t care about which scrape target exposes the metadata as much they care about what the metadata is. Scrape target information will typically be exposed as a label anyway.

The Prometheus client libraries have supported the inclusion of metadata (HELP, TYPE, and UNIT) for a while, and we’re incredibly excited to put it to good use.

Give it a try and let us know what you think! Join the conversation in the #cortex channel on Slack.

Interested in finding out more about Prometheus?

Check out the on-demand recording of the recent GrafanaCONline session, Prometheus: What the Future Holds featuring Prometheus maintainer Goutham Veeramachaneni.