Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 ยท Getting Started

The Grafana Ecosystem and the LGTM Stack

Understand how Grafana fits with Prometheus, Loki, Tempo, Mimir, Alloy and exporters, what each component stores, and how metrics, logs and traces connect.

Grafana is only the front end. To fill it with useful data you need tools that collect and store telemetry. Grafana Labs and the wider community offer a family of them, often called the LGTM stack: Loki (logs), Grafana (dashboards), Tempo (traces) and Mimir (long-term metrics). Prometheus, the most popular metrics system, is usually part of the picture as well.

This lesson is a map. You do not need to install everything: most beginners start with Grafana plus Prometheus, then add the rest when they have a reason.

The components

Component Stores or does Query language
Prometheus Scrapes and stores metrics as time series PromQL
Mimir Horizontally scalable, long-term Prometheus-compatible storage PromQL
Loki Stores logs, indexes only labels (cheap) LogQL
Tempo Stores distributed traces TraceQL
Pyroscope Continuous profiling data Profile queries
Alloy Collector: receives, transforms and ships telemetry (successor to Grafana Agent) Config language
Exporters Small programs that expose metrics for a system (node_exporter for Linux hosts, etc.) Not applicable
Grafana Queries all of the above and shows them Per data source

How the pieces connect

flowchart TB
  subgraph Apps
    A1["Service A"]
    A2["Service B"]
    H["Host: node_exporter"]
  end
  AL["Alloy collector"]
  A1 -- "logs" --> AL
  A2 -- "traces" --> AL
  H -- "metrics scrape" --> P["Prometheus / Mimir"]
  AL --> L["Loki"]
  AL --> T["Tempo"]
  P --> G["Grafana"]
  L --> G
  T --> G

Collectors and stores sit between your applications and Grafana. Grafana only reads.

Pull and push

Prometheus pulls: every few seconds it visits a /metrics URL on each target and saves what it finds. Logs and traces are usually pushed by an agent such as Alloy to Loki or Tempo. Knowing this helps when something is missing from a graph: with pull-based metrics, check whether the target is reachable; with pushed data, check the agent.

Correlating the three signals

The strength of one UI is jumping between signals:

  1. A metric panel shows error rate rising at 14:03.
  2. You open Explore on Loki for the same time range and filter error lines.
  3. A log line contains a trace_id. A configured link opens that trace in Tempo and shows the slow database call.

Grafana supports this with derived fields and trace-to-logs settings on data sources. You will see the basics in the data source chapter.

Not everything needs the full stack

Grafana also reads plain databases (MySQL, PostgreSQL, SQL Server), cloud services (CloudWatch, Azure Monitor, Google Cloud Monitoring), Elasticsearch, InfluxDB and CSV or JSON APIs through plugins. A shop owner who just wants a sales dashboard may only need Grafana and the existing MySQL database.

Stand-in: which tool answers my question?

The quick helper below maps a question to the signal type and tool. It is a study aid, not part of Grafana.

JS Stand-in: pick the right signal

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Cardinality: why Loki indexes only labels

Metrics systems and Loki both identify a data stream by its labels (for example app="shop", env="prod"). Every unique label combination creates a separate stream, so labels with many distinct values (user IDs, request IDs) explode storage. This stand-in counts streams to show the effect.

JS Stand-in: label combinations become streams

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Which parts of this course use what

  • Chapters 1 to 4 use Grafana with the built-in TestData data source plus Prometheus, Loki and SQL descriptions.
  • Alerting and provisioning (chapters 7 and 8) apply to any data source.
  • The projects combine metrics, logs and a SQL database.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the L in the LGTM stack stand for?

    LGTM is Loki, Grafana, Tempo, Mimir.
  2. 2. How does Prometheus normally collect metrics?

    Prometheus scrapes targets on an interval; push-style flows use an agent or gateway.
  3. 3. Which tool stores distributed traces?

    Tempo is the trace backend. Alloy only collects and forwards.
  4. 4. Why should you avoid a label like user_id on log streams?

    High cardinality multiplies the number of streams. Keep such values in the log text.

Summary

  • Grafana visualizes; Prometheus/Mimir, Loki, Tempo and Pyroscope store metrics, logs, traces and profiles.
  • Alloy and exporters collect the data.
  • Metrics are pulled, logs and traces are usually pushed.
  • Labels define streams; keep their values low-cardinality.
  • You can use Grafana with only a SQL database if that is all you have.

Next: Installing Grafana OSS