Grafana Dashboards for Spring Boot Service Health
Fast recall
Quick revision
Core answer
Familiarity with Grafana, PromQL, and the four golden signals framework.
Building dashboards that show raw counter values instead of rates, which are flat lines until a reset occurs.
Mention alert rules defined as code with Grafana provisioning or Prometheus alerting rules, and how to link dashboard panels to runbooks.
Interview-ready guide
Interview answer
A Grafana dashboard for a Spring Boot service should answer four questions at a glance — the four golden signals: latency, traffic (request rate), errors, and saturation. Every other panel is a supplement to these four.
Four golden signals
- Request rate:
rate(http_server_requests_seconds_count{application="my-service"}[5m])— requests per second; visualize as a time-series line; spike indicates load increase - Error rate:
rate(http_server_requests_seconds_count{status=~"5.."}[5m]) / rate(http_server_requests_seconds_count[5m])— percentage of 5xx responses; alert when above 1% - Latency:
histogram_quantile(0.99, rate(http_server_requests_seconds_bucket[5m]))— P99 latency in seconds; alert when above SLO threshold (e.g., 500ms) - Saturation: JVM heap usage
jvm_memory_used_bytes{area="heap"} / jvm_memory_max_bytes{area="heap"}and HikariCP pending connectionshikaricp_connections_pending
JVM health panels
- Heap usage over time: identify trends toward GC pressure before the GC becomes a problem; a sawtooth pattern is normal GC behavior; a flat rising line without drops indicates a memory leak
- GC pause duration:
rate(jvm_gc_pause_seconds_sum[5m]) / rate(jvm_gc_pause_seconds_count[5m])— average GC pause time; above 200ms on average indicates GC tuning is needed - Thread count:
jvm_threads_live_threadstrending upward indicates a thread leak
Database health panels
- HikariCP active connections:
hikaricp_connections_active— approachingmaximumPoolSizeindicates pool saturation - Connection acquisition time: how long threads wait for a pool connection; above a few milliseconds consistently means queries are too slow or pool size is too small
Organize the dashboard into rows: Service Health (golden signals), JVM Health, Database, and Infrastructure. Use Grafana's variable feature for $application and $environment to make one dashboard serve all services.
Grafana Dashboards for Spring Boot Service Health
Direct Answer
Use the Prometheus data source in Grafana. Build panels for the four golden signals: latency (P99), traffic (req/s), errors (5xx rate), and saturation (CPU, JVM heap). Import community dashboards like JVM Micrometer (ID 4701) as a starting point.
Common Mistakes & Pitfalls
Building dashboards that show raw counter values instead of rates, which are flat lines until a reset occurs.
Check your understanding
Answer these without looking back at the article.
- What are the four golden signals and where do they come from?
- How do you set up Grafana dashboard provisioning as code?
- What is the difference between a Grafana alert and a Prometheus alerting rule?
Related interview prep categories
1Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.