123DevOps··6 min read

The LGTM stack explained: Loki, Grafana, Tempo, and Mimir — what each one does and how they fit together

What LGTM stands for, the role of each component (logs, visualization, traces, and metrics), Alloy and Pyroscope, an object storage–based architecture, how the signals link together, and when to self-host versus go managed.

Observability

Anyone researching open source observability quickly runs into the acronym LGTM. Beyond the nod to the “looks good to me” of code reviews, it names the stack maintained by Grafana Labs that covers the main observability signals:

  • L — Loki: logs
  • G — Grafana: visualization, dashboards, and alerting
  • T — Tempo: distributed traces
  • M — Mimir: metrics

In this article, we explain the role of each piece, how they talk to each other, and what to consider before putting it all into production.

The big picture

 Applications (OpenTelemetry SDK)    Nodes / Kubernetes
            │  OTLP                         │
            ▼                               ▼
   ┌──────────────────────── Alloy / OTel Collector ─────────────────────────┐
   │  receives, filters, enriches and routes each signal                     │
   └───────┬───────────────────┬────────────────────┬───────────────────┬────┘
           ▼                   ▼                    ▼                   ▼
        Mimir               Loki                 Tempo             Pyroscope
       (metrics)            (logs)              (traces)           (profiles)
           └───────────────────┴─────────┬──────────┴───────────────────┘
                                         ▼
                                      Grafana
                    dashboards • Explore • alerts • correlation

All the backends store their data in object storage (S3, GCS, Azure Blob, or MinIO). That is what makes the stack cheap for retaining large volumes for a long time.

Loki: logs indexed by labels only

Loki’s big idea is to not index the content of logs. It indexes only a small set of labels (such as namespace, app, cluster) and stores the lines compressed in chunks. At query time, it selects chunks by their labels and scans the content.

  • Upside: much cheaper ingestion and storage than solutions that index every word.
  • Watch out: high-cardinality values (user ID, trace_id) should not become labels; for those cases there is structured metadata, attached to each line without entering the index.
  • Language: LogQL, inspired by PromQL — see the article on querying logs.

Grafana: the visualization layer

Grafana does not store telemetry data: it queries data sources and presents everything in dashboards. Beyond the LGTM stack, it connects to Prometheus, Elasticsearch, SQL databases, CloudWatch, Azure Monitor, and dozens of other sources.

Core features:

  • Dashboards — see the step-by-step guide to building them;
  • Explore — ad hoc queries during investigations;
  • Alerting — alert rules on top of any data source;
  • Correlations — jumps between signals (from a log to its trace, from a trace to its profile).

Tempo: traces without an expensive index

Tempo stores distributed traces directly in object storage, also without indexing every attribute. It ingests OTLP, Jaeger, and Zipkin data, and is queried with the TraceQL language:

{ resource.service.name = "checkout" && span.http.response.status_code >= 500 && duration > 1s }

A very useful feature is Tempo’s metrics generator: it computes RED metrics and the service graph from spans and sends them to Mimir — you get dependency graphs between services with no extra instrumentation.

Mimir: Prometheus at scale

Mimir is a Prometheus-compatible, horizontally scalable metrics store. Prometheus instances (or Alloy, or the OTel Collector) send data via remote_write, and Mimir provides:

  • Cheap long-term retention in object storage;
  • High availability with replication and deduplication;
  • Multi-tenancy, isolating teams or environments via the X-Scope-OrgID header;
  • Fast PromQL queries over billions of series, with per-tenant limits (see cardinality in Prometheus and Mimir).

Configuring Prometheus with remote_write is the most common way to start sending metrics to Mimir.

The supporting cast: Alloy and Pyroscope

  • Grafana Alloy is Grafana Labs’ collector — a distribution of the OpenTelemetry Collector with extra components (Prometheus scraping, log collection, eBPF profiling). It replaced the old Grafana Agent. If you have already standardized on the OTel Collector, you can stick with it: the stack accepts OTLP.
  • Pyroscope stores continuous profiles, the fourth signal. That is why the stack sometimes shows up as LGTM+P.

How the signals connect

The stack shines when the signals are linked (details in correlating signals):

From To How
Metric (Mimir) Trace (Tempo) Exemplars on histograms
Log (Loki) Trace (Tempo) Derived fields extracting the trace_id from the line
Trace (Tempo) Logs (Loki) Trace to logs filtering by trace_id and service
Trace (Tempo) Metrics (Mimir) Metrics generator and service graph
Trace (Tempo) Profile (Pyroscope) Trace to profiles by span

Trying it out in 1 minute

For learning or a proof of concept, there is an all-in-one image — Grafana, Loki, Tempo, Mimir (or Prometheus), Pyroscope, and an OTel Collector:

docker run -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtm

Point your application’s OpenTelemetry SDK at localhost:4318 (OTLP HTTP) and open http://localhost:3000. Do not use this image in production: it has neither persistence nor high availability.

In production

Each component can run in monolithic mode (a single binary, good for small and medium volumes) or in microservices mode (distributors, ingesters, queriers, and compactors scaled independently). On Kubernetes, the official Helm charts (loki, tempo-distributed, mimir-distributed, and grafana) are the starting point.

Things to watch:

  • Object storage with lifecycle rules and per-tenant retention;
  • Properly sized caches (memcached) — they have a big impact on query performance;
  • Per-tenant limits on every component, so one team can’t take down the cluster;
  • Monitoring the stack itself (the projects publish ready-made dashboards and alerts, the mixins);
  • License: Grafana, Loki, Tempo, and Mimir are distributed under AGPLv3 — usually no impact for internal use, but it’s worth a legal review if you plan to offer the stack as a service.

Self-hosted or managed?

Criterion Self-hosted Managed (Grafana Cloud or similar)
Direct cost Infrastructure + storage By ingested volume and users
Operational cost High: upgrades, scaling, incidents in the stack itself Low
Control and data sovereignty Full Depends on region and contract
Time to value Weeks Hours

A rule of thumb: if your platform team is still small, start managed and standardize collection on OpenTelemetry. Since every component speaks open protocols (OTLP, remote_write, LogQL, PromQL), migrating later remains possible.

How it compares to the alternatives

  • ELK/OpenSearch: very powerful full-text search, but indexing everything costs more in storage and memory.
  • Prometheus + Thanos: an alternative to Mimir for metrics at scale, also built on object storage.
  • Jaeger: an alternative to Tempo for traces, with different storage options.
  • Commercial APM platforms: more out-of-the-box features, higher cost, and more vendor lock-in.

Getting-started checklist

  • Test the stack locally with grafana/otel-lgtm
  • Standardize collection with OpenTelemetry or Alloy
  • Define object storage and retention per signal
  • Configure correlations between Loki, Tempo, and Mimir in Grafana
  • Define per-tenant limits
  • Monitor the stack itself with the official mixins

LGTM is not a tool, it’s a set of specialized pieces — each one cheap and scalable for its signal, and all of them tied together by Grafana.

Get updates on new posts and stay in the loop!