Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I visualize a histogram with Promdash or Grafana?

I'm attracted to prometheus by the histogram (and summaries) time-series, but I've been unsuccessful to display a histogram in either promdash or grafana. What I expect is to be able to show:

  • a histogram at a point in time, e.g. the buckets on the X axis and the count for the bucket on the Y axis and a column for each bucket
  • a stacked graph of the buckets such that each bucket is shaded and the total of the stack equals the inf bucket

A sample metric would be the response time of an HTTP server.

like image 886
TvE Avatar asked Aug 25 '16 00:08

TvE


People also ask

How do you visualize a histogram in Grafana?

Recent releases of Grafana have a builtin Heatmap visualization type, but use it sparingly as it can be very computationally expensive. One can achieve a histogram by selecting a Graph visualization then under Axes selecting Histogram for X-Axis > Mode .

How does histogram work in Prometheus?

Prometheus stores histograms internally in buckets that have a max size (labeled le ), but no minimum size. You must configure the number and max size of each bucket ahead of time. Each bucket time series will contain the count of observations that was less than or equal to its le value for a given timestamp.


1 Answers

Grafana v5+ provides direct support for representing Prometheus histograms as heatmap. http://docs.grafana.org/features/panels/heatmap/#histograms-and-buckets

Heatmaps are preferred over histogram because a histogram does not show you how the trend changes over time. So if you have a time-series histogram, then use the heatmap panel to picture it.

To get you started, here is an example (for Prometheus data):

Suppose you've a histogram as follows,

http_request_duration_seconds_bucket(le=0.2) 1, http_request_duration_seconds_bucket(le=0.5) 2, http_request_duration_seconds_bucket(le=1.0) 2, http_request_duration_seconds_bucket(le=+inf) 5 http_request_duration_seconds_count 5 http_request_duration_seconds_sum 3.07 

You can picture this histogram data as a heatmap by using the query: sum(increase(http_request_duration_seconds_bucket[10m])) by (le), making sure to set the format as "heatmap," the legend format as {{ le }}, and setting the visualization in the panel settings to "heatmap."

enter image description here

like image 104
Pankaj Avatar answered Sep 19 '22 11:09

Pankaj