> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Building High Level KPI Panels

> Guide to building Grafana single-value KPI panels and complementary time-series panels with Prometheus metrics for Kubernetes monitoring

Welcome to this lesson: Single-Value Panels for At-a-Glance Health Monitoring.

This guide shows how to build a compact "At-a-Glance" summary row in Grafana using single-value panels (Stat, Gauge, Bar Gauge) and complementary time-series panels for troubleshooting. You will also add a few Kubernetes infrastructure indicators. The content below preserves all example PromQL queries, recommended visualization settings, and the original diagram placements.

Prerequisites

* Grafana and Prometheus are provisioned for the lab.
* You can access the Order Processing UI to generate test traffic.

Quick links

* Grafana docs: [https://grafana.com/docs/](https://grafana.com/docs/)
* Prometheus docs: [https://prometheus.io/docs/](https://prometheus.io/docs/)

1. Apply the dashboard ConfigMap
   Provision the provided dashboard ConfigMap so the "Golden Signals" dashboard is available in Grafana:

```bash theme={null}
kubectl apply -f monitoring/golden-signals-configmap.yaml
```

Sample output:

```bash theme={null}
configmap/golden-signals-dashboard created
```

Open the Grafana UI, log in with your temporary lab credentials, and confirm the dashboard appears. If no data is visible, start traffic generation in the Order Processing UI (e.g., Medium traffic, low error rate, faster processing). The Grafana panels should populate shortly.

2. Add the "Golden Signals — At-a-Glance Summary" row
   Create a new row in the Golden Signals dashboard to host high-level KPIs:

* Enter Edit mode for the dashboard.
* Add → Row.
* Name it: "Golden Signals — At-a-Glance Summary" (or similar).
* Save the row (it will start empty).

3. Single-value panels (Stat / Gauge / Bar Gauge)
   Single-value panels show current status instantly. Use them for war-room views, executive glance, and alert triage. Pair them with time-series panels for history and root-cause analysis.

Note: For stat panels that should show the single most recent value, use Instant query mode. Instant queries fetch the latest value quickly and reduce query costs, which is ideal for dashboards with many single-value panels.

Use Instant queries for single-value panels to fetch only the latest value faster and reduce query cost.

Below are recommended panels with example PromQL, visualization settings, and thresholds.

Panel 1 — Current backend request rate (Stat)
Purpose: Show backend throughput in requests/second, excluding health and metrics endpoints.

PromQL (example):

```promql theme={null}
sum(rate(http_server_duration_milliseconds_count{job="order-backend", http_target!~"/health|/metrics"}[5m]))
```

Settings:

* Visualization: Stat
* Stat styles → Graph mode: None (disable mini-graph)
* Query mode: Instant
* Thresholds (example): Green \< 5, Yellow 5–15, Red > 15 (adjust to your traffic)

Panel 2 — Current frontend request rate (Stat)
Duplicate Panel 1 and change the job selector for the frontend:

```promql theme={null}
sum(rate(http_server_duration_milliseconds_count{job="order-frontend", http_target!~"/health|/metrics"}[5m]))
```

Keep the same visualization settings and thresholds to make frontend/backend values comparable.

Panel 3 — Backend error rate (Gauge)
Purpose: Show current error rate as a percentage (4xx/5xx of total responses).

PromQL (example):

```promql theme={null}
100 * (
  sum(rate(http_server_duration_milliseconds_count{job="order-backend", http_status_code=~"(4|5).*"}[1m]))
  /
  sum(rate(http_server_duration_milliseconds_count{job="order-backend"}[1m]))
)
```

Settings:

* Visualization: Gauge
* Unit: Percent
* Thresholds (example): Green 0–1, Yellow 1–5, Red > 5

Panel 4 — Frontend error rate (Gauge)
Duplicate Panel 3 and change the job label:

```promql theme={null}
100 * (
  sum(rate(http_server_duration_milliseconds_count{job="order-frontend", http_status_code=~"(4|5).*"}[1m]))
  /
  sum(rate(http_server_duration_milliseconds_count{job="order-frontend"}[1m]))
)
```

4. Single-value vs. Time-series — when to use each

* Single-value (Stat/Gauge/Bar Gauge): Fast current-state visibility (good for SREs, on-call, executives).
* Time-series: Show trends, spikes, and durations — essential for troubleshooting when an incident started and how it evolved.

Best practice: Keep both — a compact single-value row for immediate awareness, plus time-series panels available for deep dives.

5. Latency and service comparison panels (P95)
   Add P95 latency stat panels for backend and frontend. Note: units differ in this lab—backend metrics are in milliseconds, frontend metrics in seconds. Set units and thresholds accordingly.

Panel 5 — Backend P95 latency (Stat)
PromQL:

```promql theme={null}
histogram_quantile(0.95, sum by (le) (rate(http_server_duration_milliseconds_bucket{job="order-backend"}[5m])))
```

Settings:

* Visualization: Stat
* Graph mode: Area (optional)
* Unit: Time → milliseconds
* Decimals: 0
* Thresholds: Green \< 400 ms, Yellow 400–500 ms, Red > 500 ms

Panel 6 — Frontend P95 latency (Stat)
PromQL:

```promql theme={null}
histogram_quantile(0.95, sum by (le) (rate(http_server_duration_seconds_bucket{job="order-frontend"}[5m])))
```

Settings:

* Visualization: Stat
* Graph mode: Area (optional)
* Unit: Time → seconds
* Decimals: Auto (or tune as needed)
* Thresholds: Green \< 0.4 s, Yellow 0.4–0.5 s, Red > 0.5 s

Save the dashboard JSON model (Dashboard settings → JSON model → Save / Submit) to persist these changes.

6. Kubernetes infrastructure health indicators
   Add Kubernetes single-value panels to monitor basic infra health: pod readiness per deployment and pod restarts.

Pod readiness by deployment (Bar Gauge)
Use a Bar Gauge to display ready replica counts per deployment. Query each deployment separately or use label grouping.

Example queries:

* Order frontend ready replicas:

```promql theme={null}
kube_deployment_status_replicas_ready{deployment="order-frontend", namespace="default"}
```

* Order backend ready replicas:

```promql theme={null}
kube_deployment_status_replicas_ready{deployment="order-backend", namespace="default"}
```

Settings:

* Visualization: Bar gauge
* Orientation: Horizontal
* Display mode: Basic
* Show unfilled area: No (optional)
* Field overrides: set min/max per deployment (e.g., frontend max = 2, backend max = 4)

![A screenshot of a Grafana dashboard edit view showing a "Pod Readiness by Deployment" bar gauge with two green bars labeled order-frontend (2) and order-backend (4). The right side shows panel options and visualization settings.](https://mintcdn.com/kodekloud-c4ac6d9a/qM9vA-hQoWNCxcKa/images/Grafana-Prometheus-for-Metrics-Driven-Observability/Visualizing-Metrics-in-Grafana/Demo-Building-High-Level-KPI-Panels/grafana-pod-readiness-order-frontend-backend.jpg?fit=max\&auto=format\&n=qM9vA-hQoWNCxcKa\&q=85\&s=15970b1eed0b62eb040537b67ecac625)

Pod restarts (Stat)
Monitor recent restarts using increase() over a window (e.g., 15 minutes). Sum across matching pods.

Backend restarts over the last 15 minutes:

```promql theme={null}
sum(increase(kube_pod_container_status_restarts_total{namespace="default", pod=~"order-backend-.*"}[15m]))
```

Frontend restarts over the last 15 minutes:

```promql theme={null}
sum(increase(kube_pod_container_status_restarts_total{namespace="default", pod=~"order-frontend-.*"}[15m]))
```

Settings:

* Visualization: Stat
* Display: Background solid, Graph mode: None
* Color mode: Horizontal with thresholds
* Example thresholds: Green = 0, Yellow = 1, Red = 2+

7. Move panels into the At-a-Glance row and save

* Move the panels created above into the "At-a-Glance" row.
* Save the dashboard (Dashboard settings → JSON model → Save / Submit).
* Verify values in your lab environment; panels should show:
  * Request rate stats for frontend and backend
  * Error rate gauges for frontend and backend
  * Latency (P95) stats for frontend (seconds) and backend (milliseconds)
  * Pod readiness bar gauge and pod restart stats

![A Grafana monitoring dashboard titled "Golden Signals: At-a-Glance Summary" showing current backend and frontend request rates (0.0175 req/s), error rates at 0%, and latency panels with values like 488 ms and 1.44 s.](https://mintcdn.com/kodekloud-c4ac6d9a/qM9vA-hQoWNCxcKa/images/Grafana-Prometheus-for-Metrics-Driven-Observability/Visualizing-Metrics-in-Grafana/Demo-Building-High-Level-KPI-Panels/grafana-golden-signals-requests-errors-latency.jpg?fit=max\&auto=format\&n=qM9vA-hQoWNCxcKa\&q=85\&s=84d4bb64fecb4ed0318db4d00f38f2fb)

8. Choosing panel types — guidance

* Gauge: Best when you want a visual arc showing utilization relative to a max (e.g., CPU utilization).
* Stat: Use when you need a concise numeric value (counts, rates) without arc emphasis.
* Time series: Always use for trends, distributions, and incident investigation.
* Bar Gauge: Best for showing relative counts (e.g., ready replicas across deployments).

9. Panel summary (quick reference)
   \| Panel | Visualization | Key PromQL (short) | Unit | Example thresholds |
   \|---|---:|---|---|---|
   \| Backend request rate | Stat | `sum(rate(...[5m]))` | req/s | Green \< 5, Yellow 5–15, Red > 15 |
   \| Frontend request rate | Stat | `sum(rate(...[5m]))` | req/s | same as backend |
   \| Backend error rate | Gauge | `100 * (sum(rate(...4xx/5xx...))/sum(rate(...)))` | % | Green 0–1, Yellow 1–5, Red > 5 |
   \| Frontend error rate | Gauge | `100 * (...)` | % | same as backend |
   \| Backend P95 latency | Stat | `histogram_quantile(0.95, sum by (le)(rate(..._bucket...)))` | ms | Green \< 400 ms, Yellow 400–500 ms, Red > 500 ms |
   \| Frontend P95 latency | Stat | `histogram_quantile(0.95, ...)` | s | Green \< 0.4 s, Yellow 0.4–0.5 s, Red > 0.5 s |
   \| Pod readiness per deployment | Bar Gauge | `kube_deployment_status_replicas_ready{...}` | replicas | Use min/max overrides |
   \| Pod restarts (15m) | Stat | `sum(increase(kube_pod_container_status_restarts_total[15m]))` | count | Green 0, Yellow 1, Red 2+ |

References and further reading

* Grafana: [https://grafana.com/docs/](https://grafana.com/docs/)
* Prometheus: [https://prometheus.io/docs/](https://prometheus.io/docs/)
* PromQL basics: [https://prometheus.io/docs/prometheus/latest/querying/basics/](https://prometheus.io/docs/prometheus/latest/querying/basics/)
* Kubernetes metrics with kube-state-metrics: [https://github.com/kubernetes/kube-state-metrics](https://github.com/kubernetes/kube-state-metrics)

Wrap-up
You now have a compact, high-level KPI row for quick status checks and detailed time-series panels for troubleshooting. This At-a-Glance approach supports multiple audiences (SREs, on-call engineers, executives) and keeps the dashboard actionable: single-value panels for immediate awareness and time-series panels for root-cause analysis.

> [card] [Watch Video](https://learn.kodekloud.com/user/courses/grafana-prometheus-for-metrics-driven-observability/module/38f09b30-873f-4fee-aef2-95161646dfdc/lesson/bb8d173d-6477-4a5a-8251-ce615ffa5211)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.