Video in progress

What is Grafana used for, and how does it work together with Prometheus?

Grafana is a visualization tool: it takes data from sources like Prometheus, Loki and Elasticsearch, draws dashboards and graphs, and can also set alerts. Prometheus stores, Grafana displays.

📖 Answer

Prometheus has its own web interface, but it is handy only for quick queries. The dashboards a team looks at every day are usually in Grafana.

In Grafana you add Prometheus as a "data source", then write PromQL into a panel:

sum(rate(http_server_requests_seconds_count{status=~"5.."}[5m])) by (uri)

This panel draws the number of 5xx errors per second for each endpoint.

Useful things in practice:

  • there are ready-made dashboards (for example, the JVM Micrometer dashboard): you import one and immediately see heap, GC and threads;
  • variables ($service, $instance): use one dashboard for every service;
  • seeing metrics, logs in Loki and traces in Tempo linked together on one screen.

Grafana doesn't store the data itself. If Prometheus goes down, the graphs are empty too.