2022-05-26 23:06:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								aliases:
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 00:36:04 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  -  ../basics/intro-histograms/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  ../getting-started/intro-histograms/
							 
						 
					
						
							
								
									
										
										
										
											2022-05-26 23:06:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								description: An introduction to histograms and heatmaps
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								keywords:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  grafana
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  heatmap
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  panel
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  documentation
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  histogram
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Explicitly set all front matter labels in the source files (#71548)
* Set every page to have defaults of 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/enterprise-licensing pages to have 'Enterprise' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/recorded-queries pages to have labels cloud,enterprise
* Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/stats-and-license pages to have labels cloud,enterprise
* Set alerting pages to have labels cloud,enterprise,oss
* Set breaking-changes pages to have labels cloud,enterprise,oss
* Set dashboards pages to have labels cloud,enterprise,oss
* Set datasources pages to have labels cloud,enterprise,oss
* Set explore pages to have labels cloud,enterprise,oss
* Set fundamentals pages to have labels cloud,enterprise,oss
* Set introduction/grafana-cloud pages to have labels cloud
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Fix introduction pages products
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set panels-visualizations pages to have labels cloud,enterprise,oss
* Set release-notes pages to have labels cloud,enterprise,oss
* Set search pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set troubleshooting pages to have labels cloud,enterprise,oss
* Set whatsnew pages to have labels cloud,enterprise,oss
* Apply updated labels from review
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
---------
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
											 
										 
										
											2023-07-18 16:10:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								labels:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  products:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    -  cloud
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    -  enterprise
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    -  oss
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 22:50:20 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								menuTitle: Histograms and heatmaps
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								title: Introduction to histograms and heatmaps
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 00:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								weight: 650
							 
						 
					
						
							
								
									
										
										
										
											2022-05-26 23:06:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# Introduction to histograms and heatmaps
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								A histogram is a graphical representation of the distribution of numerical data. It groups values into buckets
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								(sometimes also called bins) and then counts how many values fall into each bucket.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Instead of graphing the actual values, histograms graph the buckets. Each bar represents a bucket,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								and the bar height represents the frequency (such as count) of values that fell into that bucket's interval.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Histogram example
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 23:41:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								This _histogram_  shows the value distribution of a couple of time series. You can easily see that
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								most values land between 240-300 with a peak between 260-280.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 17:27:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 23:41:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Here is an example showing height distribution of people.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{{<  figure  src = "/static/img/docs/histogram-panel/histogram-example-v8-0.png"  max-width = "625px"  caption = "Bar chart example"  > }}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 00:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								For more information about histogram visualization options, refer to [Histogram][histogram].
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 23:41:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Histograms only look at _value distributions_  over a specific time range. The problem with histograms is that you cannot see any trends or changes in the distribution over time. This is where heatmaps become useful.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Heatmaps
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								A _heatmap_  is like a histogram, but over time, where each time slice represents its own histogram. Instead of using bar height as a representation of frequency, it uses cells, and colors the cell proportional to the number of values in the bucket.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								In this example, you can clearly see what values are more common and how they trend over time.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 17:27:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 00:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								For more information about heatmap visualization options, refer to [Heatmap][heatmap].
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 23:41:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Pre-bucketed data
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								There are a number of data sources supporting histogram over time, like Elasticsearch (by using a Histogram bucket
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								aggregation) or Prometheus (with [histogram ](https://prometheus.io/docs/concepts/metric_types/#histogram ) metric type
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								and _Format as_  option set to Heatmap). But generally, any data source could be used as long as it meets the requirement
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								that it either returns series with names representing bucket bounds, or that it returns series sorted by the bounds
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								in ascending order.
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Raw data vs aggregated
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If you use the heatmap with regular time series data (not pre-bucketed), then it's important to keep in mind that your data
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								is often already aggregated by your time series backend. Most time series queries do not return raw sample data,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								but instead include a group by time interval or maxDataPoints limit coupled with an aggregation function (usually average).
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								This all depends on the time range of your query of course. But the important point is to know that the histogram bucketing
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								that Grafana performs might be done on already aggregated and averaged data. To get more accurate heatmaps, it is better
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								to do the bucketing during metric collection, or to store the data in Elasticsearch or any other data source which
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								supports doing histogram bucketing on the raw data.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-05 03:03:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								If you remove or lower the group by time (or raise maxDataPoints) in your query to return more data points, your heatmap will be
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								more accurate, but this can also be very CPU and memory taxing for your browser, possibly causing hangs or crashes if the number of
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 06:23:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								data points becomes unreasonably large.
							 
						 
					
						
							
								
									
										
										
										
											2023-06-17 00:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{{% docs/reference %}}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[heatmap]: "/docs/grafana/ -> /docs/grafana/< GRAFANA  VERSION > /panels-visualizations/visualizations/heatmap"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[heatmap]: "/docs/grafana-cloud/ -> /docs/grafana/< GRAFANA  VERSION > /panels-visualizations/visualizations/heatmap"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[histogram]: "/docs/grafana/ -> /docs/grafana/< GRAFANA  VERSION > /panels-visualizations/visualizations/histogram"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[histogram]: "/docs/grafana-cloud/ -> /docs/grafana/< GRAFANA  VERSION > /panels-visualizations/visualizations/histogram"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{{% /docs/reference %}}