Setting Up Grafana Tempo via Docker

Introduction to Distributed Tracing & Grafana Tempo Part 1 DevOps Docs

πŸ“Œ 2. Setting Up Grafana Tempo (Development Environment)

We will install Grafana Tempo using Docker Compose, along with Grafana for visualization and OpenTelemetry Collector for trace ingestion.


1️⃣ Prerequisites

βœ… Install Docker & Docker Compose

Verify installation:

docker -v
docker compose -v

2️⃣ Setting Up Docker Compose for Tempo

We will create a docker-compose.yaml file to run Tempo, OpenTelemetry Collector, and Grafana.

Step 1: Create a New Directory

mkdir grafana-tempo && cd grafana-tempo

Step 2: Create docker-compose.yaml

vim docker-compose.yml

πŸ“Œ Paste the following configuration:

version: '3.7'

services:
  tempo:
    image: grafana/tempo:latest
    command: [ "-config.file=/etc/tempo.yml" ]
    volumes:
      - ./tempo-config.yml:/etc/tempo.yml
    ports:
      - "3200:3200"  # Tempo Query Port
      - "14268:14268"  # Jaeger ingest
      - "4317:4317"  # OTLP gRPC
      - "4318:4318"  # OTLP HTTP

  grafana:
    image: grafana/grafana:latest
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
    depends_on:
      - tempo

  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    command: [ "--config=/etc/otel-collector-config.yml" ]
    volumes:
      - ./otel-collector-config.yml:/etc/otel-collector-config.yml
    ports:
      - "4319:4317"  # OTLP gRPC or just keep "4317" no host port mapping
      - "4320:4318"  # OTLP HTTP or just keep "4318" no host port mapping
      - "55680:55680"  # OpenTelemetry HTTP Debugging
    depends_on:
      - tempo

3️⃣ Create Tempo Configuration

Create a tempo-config.yml file for Tempo.

nano tempo-config.yml

πŸ“Œ Paste the following configuration:

server:
  http_listen_port: 3200

distributor:
  receivers:
    jaeger:
      protocols:
        grpc:
        thrift_http:
    otlp:
      protocols:
        grpc:
        http:

storage:
  trace:
    backend: local
    local:
      path: /tmp/tempo/traces

Explanation:

  • http_listen_port: 3200 β†’ Tempo API port.
  • Receivers β†’ Accept traces via Jaeger & OpenTelemetry (OTLP).
  • Storage β†’ Using local storage (/tmp/tempo/traces) for now.

4️⃣ Create OpenTelemetry Collector Configuration

Create a otel-collector-config.yml file.

nano otel-collector-config.yml

πŸ“Œ Paste the following configuration:

receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  otlp:
    endpoint: tempo:4317
    tls:
      insecure: true

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlp]

Explanation:

  • Receives traces using OTLP protocol.
  • Exports traces to Tempo at tempo:4317.

5️⃣ Start Tempo, Grafana & OTEL Collector Now, run Docker Compose:

docker compose up -d

This will start:

βœ… Tempo (port 3200)

βœ… Grafana (port 3000)

βœ… OTEL Collector (host port 4317, 4318)

Check running containers:

docker ps

6️⃣ Verify Setup

πŸ”Ή Check Tempo Status

Open Grafana UI at πŸ‘‰ http://localhost:3000

  • Login: username:- admin password: admin

  • Go to Configuration > Data Sources
  • Add Tempo as a data source
  • Set URL as http://tempo:3200
  • Click Save & Test

Now that Tempo is running, we need to generate traces.

βœ… Let’s generate traces by instrumenting a sample python application. We’ll use OpenTelemetry (OTel) SDK to send traces to Tempo. πŸš€