Deploy the demo application and provision the Grafana dashboard
- Run the app setup script to deploy the demo backend, frontend, and ServiceMonitors:
- Apply the prebuilt Grafana dashboard ConfigMap (golden-signals):
Provisioning dashboards via a ConfigMap + Grafana sidecar is an Infrastructure-as-Code pattern. It enables reproducible dashboards, version control, and automated dashboard deployments across environments.
Why use heatmaps instead of (or in addition to) histograms?
- Histogram (single distribution): aggregates bucketed latencies across the entire time range and gives you one distribution snapshot (useful for percentiles and overall shape).
- Heatmap (distribution over time): preserves the time dimension by rendering a histogram per time slice. Color indicates density, so you can see when the distribution shifts and how the tail behaves over time.
Create a backend latency histogram (single aggregated distribution)
-
In Grafana, edit your dashboard → Add panel:
- Title: Backend HTTP Latency Distribution
- Visualization: Histogram (or keep time series and switch to Histogram)
- Optionally hide the legend for a cleaner view.
- Example PromQL to produce a single percentile (P95) time-series derived from histogram buckets:
histogram_quantile()computes the percentile from bucket counts.- The query above produces a single timeseries (p95) — not a histogram visualization itself.
- Save the panel. This represents the distribution aggregated across the selected dashboard time range (e.g., last 15 minutes).
- Aggregated histograms lose the per-time-slice evolution of the distribution. If you need to know when a shift happened, use a heatmap.
Create a backend latency heatmap (distribution over time)
-
Add a new Grafana panel:
- Title: Backend HTTP Latency Distribution Over Time
- Visualization: Heatmap
- Unit: milliseconds
- Color scheme: Spectral (useful for clear density contrast)
- In “Calculate from data” set to No so Grafana uses your histogram buckets directly
- Tooltip: enable “Show histogram” and set tooltip Y-axis to show histogram
- Prometheus query — feed Grafana the bucket counts per time slice:
- Use the
_bucketmetric (the histogram bucket series). increase(...[$__rate_interval])returns the delta for each bucket during each Grafana interval; this produces per-time-slice counts.sum by (le)(...)aggregates across all labels exceptle(the bucket boundary). Grafana expects bucketed series keyed byle.
- Configure heatmap options:
- Format: Heatmap
- Color scheme: Spectral (or any perceptually uniform palette)
- Tooltip: Show histogram, set Y-axis to histogram
- Save the dashboard.

Heatmap color selection — why Spectral helps
A multi-color palette (Spectral) makes density differences easy to spot: high-density areas appear red while low-density areas stay blue. That contrast helps you quickly identify when requests concentrate in higher-latency buckets.Hover histogram behavior
By enabling “Show histogram” in the tooltip and setting the tooltip Y-axis to histogram, Grafana surfaces the full bucket counts for the selected time column. This gives you both the time-series context and the exact distribution for that instant. Correct heatmap query (repeated for clarity):Use the order-processing UI to observe distribution changes
While the heatmap is visible, change the demo application’s load and processing latency settings to see how the heatmap reacts. Typical controls include:- Traffic level (low / medium / high)
- Average processing latency (fast / slower)
- Simulated error rate
- High-density regions shift from higher-latency buckets to lower-latency buckets over time.
- The tail (higher buckets) shrinks as queued requests complete.
- The heatmap reveals the exact times when the distribution moved.

- The aggregated histogram shows the overall distribution but not when a change occurred.
- The heatmap preserves distribution per time slice and is therefore best for identifying the exact timestamp when latency began to decrease. Hover any column to inspect the histogram for that moment.
When using
increase(...[$__rate_interval]), ensure your Grafana dashboard interval aligns with your scrape interval and the cardinality of bucket series. Very long intervals or mismatched scrape configs can produce misleading deltas. Test queries in Prometheus/Explore first if results look unexpected.Summary & best practices
- Histograms give you a single aggregated distribution across the selected time window; use them for percentiles (p50/p95/p99).
- Heatmaps add time to the distribution, letting you see how latency buckets change over time.
- For Prometheus + Grafana heatmaps:
- Use the
_bucketmetric. - Feed Grafana per-interval counts with
increase(...[$__rate_interval]). - Aggregate with
sum by (le)(...)so only thelebucket label remains.
- Use the
- Choose a perceptually clear color map (Spectral or similar) to highlight density differences.
- Provision dashboards using ConfigMaps + Grafana sidecar for reproducible, version-controlled dashboards.
Links and references
- Prometheus histogram docs: https://prometheus.io/docs/practices/histograms/
- Grafana heatmap panel docs: https://grafana.com/docs/grafana/latest/panels/visualizations/heatmap/
- Prometheus query language (PromQL): https://prometheus.io/docs/prometheus/latest/querying/basics/