Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install tempo@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin tempo v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install tempo

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/tempo/

Extract the ZIP to .github/skills/ in your repo. The folder name must match tempo for Copilot to auto-discover it.

Skill Files (3)

SKILL.md 5.5 KB
---
name: tempo
license: Apache-2.0
description: Stand up Grafana Tempo as a cost-efficient distributed-tracing backend that only needs object storage, and write TraceQL queries against it. Covers OTLP + Jaeger + Zipkin ingestion, the distributor → live-store → block-builder → object-storage write path, metrics-generator for RED spanmetrics + service graphs, Helm `tempo-distributed` deployment, multi-tenant `X-Scope-OrgID`, TraceQL span / resource / event scopes, structural operators (`>>`, `<<`), `rate()` + `quantile_over_time` metrics, and the traces-to-logs / metrics / profiles datasource links. Use when deploying Tempo, writing a TraceQL query for slow / errored requests, debugging "no traces showing in Explore", sizing queriers / compactors, configuring S3 / GCS / Azure block storage, or wiring trace ↔ log ↔ profile correlation — even when the user says "tracing backend", "find slow requests", "show me the service graph", "store traces in S3", "Jaeger compatible store", or "what called this span" without naming Tempo.
---

# Grafana Tempo

> **Docs**: https://grafana.com/docs/tempo/latest/

Cost-efficient distributed tracing. Accepts OTLP / Jaeger / Zipkin / OpenCensus / Kafka. Stores Parquet blocks in S3/GCS/Azure.

## Prerequisites

- Docker (quick start) or Kubernetes (production)
- Object storage bucket (S3/GCS/Azure) for distributed deployments
- An OTLP-emitting app or `tempo-cli` for synthetic traffic
- A Grafana stack with a Tempo datasource for querying

## Common Workflows

### 1. Stand up Tempo locally + verify ingestion

```bash
# 1. Start the official Docker Compose example
git clone https://github.com/grafana/tempo.git
cd tempo/example/docker-compose/local
mkdir -p tempo-data
docker compose up -d

# 2. Verify readiness
curl -sf http://localhost:3200/ready                              # → "ready"

# 3. Send a synthetic OTLP span (full payload in scratch terminal)
curl -X POST -H 'Content-Type: application/json' \
  http://localhost:4318/v1/traces \
  -d '{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"my-service"}}]},
       "scopeSpans":[{"spans":[{"traceId":"5B8EFFF798038103D269B633813FC700","spanId":"EEE19B7EC3C1B100",
       "name":"my-op","startTimeUnixNano":1689969302000000000,"endTimeUnixNano":1689969302500000000,"kind":2}]}]}]}'

# 4. Verify the trace landed (ingestion-counter > 0 and the trace is fetchable)
curl -s http://localhost:3200/metrics | grep tempo_distributor_spans_received_total | head
curl -s http://localhost:3200/api/v2/traces/5B8EFFF798038103D269B633813FC700 | jq '.batches | length'
# Expect > 0.

# 5. In Grafana → Explore → Tempo, run TraceQL: {resource.service.name="my-service"}
```

### 2. Send traces from an app via Alloy

```alloy
// alloy.river
otelcol.receiver.otlp "default" {
  grpc { endpoint = "0.0.0.0:4317" }
  http { endpoint = "0.0.0.0:4318" }
  output { traces = [otelcol.exporter.otlp.tempo.input] }
}

otelcol.exporter.otlp "tempo" {
  client {
    endpoint = "tempo:4317"
    tls { insecure = true }
  }
}
```

```bash
# Verify Alloy forwarded successfully
curl -s http://localhost:12345/metrics | grep otelcol_exporter_sent_spans
# Then: same Grafana → Explore → Tempo check.
```

### 3. Write + run TraceQL

```traceql
# Slow requests from a service
{ resource.service.name = "frontend" && duration > 1s }

# Server span that has a downstream error (structural)
{ kind = server } >> { status = error }

# Error rate per service (metrics)
{ status = error } | rate() by (resource.service.name)
```

Full operator + scope cheat sheet, intrinsics list, metric functions: [`references/traceql.md`](references/traceql.md).

```bash
# Via the API
curl -sG --data-urlencode 'q={resource.service.name="frontend" && duration > 1s}' \
  --data-urlencode "start=$(date -d '1h ago' +%s)" --data-urlencode "end=$(date +%s)" \
  http://localhost:3200/api/search | jq '.traces | length'
```

### 4. Deploy on Kubernetes (Helm)

```bash
helm repo add grafana https://grafana.github.io/helm-charts
helm install tempo grafana/tempo-distributed --version 1.61.3 \
  --set storage.trace.backend=s3 \
  --set storage.trace.s3.bucket=my-tempo-bucket \
  --set storage.trace.s3.region=us-east-1

# Verify every pod is Ready (distributor, ingester, querier, query-frontend, compactor)
kubectl get pods -n default -l app.kubernetes.io/instance=tempo
kubectl port-forward svc/tempo-query-frontend 3200:3200 &
curl -sf http://localhost:3200/ready
```

## Multi-tenancy

```yaml
multitenancy_enabled: true
# All requests must include header: X-Scope-OrgID: <tenant-id>
```

Full architecture, ports, performance tuning, metrics-generator config, multi-tenant client snippets, traces-to-logs/metrics/profiles datasource: [`references/architecture-and-operations.md`](references/architecture-and-operations.md).

## Troubleshooting

- `/ready` → 503 → ingester still joining; check `tempo_ingester_*` metrics + logs
- 429 on push → raise `max_outstanding_per_tenant` or per-tenant ingest limits
- "no traces showing in Explore" → confirm `X-Scope-OrgID` matches between writer and Grafana datasource
- TraceQL slow → narrow `start`/`end`, add a service.name filter, enable dedicated Parquet columns for hot attributes

## Resources

- [Tempo docs](https://grafana.com/docs/tempo/latest/)
- [TraceQL reference](https://grafana.com/docs/tempo/latest/traceql/)
- [`references/traceql.md`](references/traceql.md) — full TraceQL cheat sheet
- [`references/architecture-and-operations.md`](references/architecture-and-operations.md) — components, ports, Helm, tuning, datasource links
references/
architecture-and-operations.md 4.9 KB
# Architecture, deployment, performance

## Component map

```
Applications
   |
   v   (OTLP 4317/4318, Jaeger 14250/14268, Zipkin 9411)
[Distributor]  →  [Kafka]  →  [Live Stores]   (recent)
                            →  [Block Builders] (Parquet → object storage)
                            →  [Metrics Generator] (RED metrics → Prometheus)

Grafana → [Query Frontend] → [Querier pool] → Live Stores + Object Storage
```

| Component | Role | Default Port |
|-----------|------|--------------|
| Distributor | Receives spans, routes by traceID hash | 4317 (gRPC), 4318 (HTTP) |
| Live Store | Buffers recent data on local disk | - |
| Query Frontend | Query orchestrator + sharding | 3200 (HTTP) |
| Querier | Executes search against storage | - |
| Compactor | Merges blocks + retention | - |
| Block Builder | Final Parquet blocks → object storage | - |
| Metrics Generator | RED metrics from spans | - |

## Deployment

### Docker Compose quick start

```bash
git clone https://github.com/grafana/tempo.git
cd tempo/example/docker-compose/local
mkdir tempo-data
docker compose up -d
# Grafana → http://localhost:3000  |  Tempo API → http://localhost:3200
```

### Kubernetes (Helm `tempo-distributed`)

```bash
helm repo add grafana https://grafana.github.io/helm-charts
helm install tempo grafana/tempo-distributed --version 1.61.3 \
  --set storage.trace.backend=s3 \
  --set storage.trace.s3.bucket=my-tempo-bucket \
  --set storage.trace.s3.region=us-east-1
```

## Multi-tenancy

```yaml
multitenancy_enabled: true
# All requests need X-Scope-OrgID: <tenant-id>
```

OTel Collector header:

```yaml
exporters:
  otlp:
    headers:
      x-scope-orgid: tenant-id
```

Grafana datasource:

```yaml
jsonData:
  httpHeaderName1: "X-Scope-OrgID"
secureJsonData:
  httpHeaderValue1: "tenant-id"
```

## Ports

| Port | Protocol | Purpose |
|------|----------|---------|
| 3200 | HTTP | Tempo API (queries, search, health) |
| 9095 | gRPC | Internal component communication |
| 4317 | gRPC | OTLP trace ingestion |
| 4318 | HTTP | OTLP trace ingestion |
| 14268 | HTTP | Jaeger Thrift HTTP |
| 14250 | gRPC | Jaeger gRPC |
| 6831 / 6832 | UDP | Jaeger Thrift Compact / Binary |
| 9411 | HTTP | Zipkin ingestion |
| 7946 | TCP/UDP | Memberlist gossip |

## Performance tuning

| Problem | Solution |
|---------|----------|
| Slow searches | Scale queriers; scale compactors to reduce block count |
| High querier memory | Reduce `max_concurrent_queries`; lower `target_bytes_per_job` |
| High ingester memory | Reduce `max_block_bytes`; lower per-tenant trace limits |
| Slow attribute queries | Add dedicated Parquet columns for frequent attributes |
| Cache miss high | Increase cache size; tune `cache_min_compaction_level` |
| 429 rate-limited | Raise `max_outstanding_per_tenant` or per-tenant ingest limits |
| Memcached errors | Increase memcached conns (`-c 4096`) |

## Best-practice notes

- Replication factor 3 in prod for HA
- Object storage required for distributed deployments
- Enable dedicated attribute columns for most-queried attributes
- Set block retention per-tenant via `overrides`
- Watch `tempo_ingester_live_traces` for ingester pressure
- Follow OpenTelemetry semantic conventions (`span.*`, `resource.*`)
- ~128 attrs/span max; use span linking for batch processing

## Metrics from traces

```yaml
metrics_generator:
  storage:
    path: /var/tempo/generator/wal
    remote_write:
      - url: http://prometheus:9090/api/v1/write
        send_exemplars: true

overrides:
  defaults:
    metrics_generator:
      processors: [service-graphs, span-metrics]
```

Processors:

- **Service Graphs** → `traces_service_graph_request_total`, `traces_service_graph_request_failed_total`, duration histograms
- **Span Metrics** (RED) → `traces_spanmetrics_calls_total`, `traces_spanmetrics_duration_seconds_*` with service / span_name / span_kind / status_code
- **Local Blocks** → enables TraceQL metrics queries on recent data

## Grafana datasource (traces-to-logs/metrics/profiles)

```yaml
datasources:
  - name: Tempo
    type: tempo
    url: http://tempo:3200
    jsonData:
      tracesToLogsV2:
        datasourceUid: loki-uid
        filterByTraceID: true
        tags: [{key: "service.name", value: "app"}]
      tracesToMetrics:
        datasourceUid: prometheus-uid
        tags: [{key: "service.name", value: "service"}]
        queries:
          - name: Error Rate
            query: 'sum(rate(traces_spanmetrics_calls_total{$$__tags, status_code="STATUS_CODE_ERROR"}[5m]))'
      tracesToProfiles:
        datasourceUid: pyroscope-uid
        tags: [{key: "service.name", value: "service_name"}]
      serviceMap:
        datasourceUid: prometheus-uid
```

## HTTP API

```bash
# Search
GET /api/search?q={status=error}&limit=20&start=<unix>&end=<unix>

# Trace by ID
GET /api/traces/<traceID>
GET /api/v2/traces/<traceID>

# Tags
GET /api/search/tags
GET /api/search/tag/service.name/values

# TraceQL metrics
GET /api/metrics/query_range?q={status=error}|rate()&start=...&end=...&step=60

# Health
GET /ready
```
traceql.md 2.0 KB
# TraceQL — query language

Structure: `{ filters } | pipeline`

## Attribute scopes

```traceql
span.http.status_code        # span-level
resource.service.name        # resource-level (from SDK)
event.name                   # event-level
name                         # intrinsic: span operation name
status                       # intrinsic: ok | error | unset
duration                     # intrinsic: span duration
kind                         # intrinsic: server | client | producer | consumer | internal
traceDuration                # intrinsic: entire trace duration
rootServiceName              # intrinsic: service of the root span
rootName                     # intrinsic: operation name of the root span
```

## Operators

```
=   !=   >   <   >=   <=      # comparison
=~  !~                         # regex (Go RE2)
&&  ||  !                      # logical
```

## Essential queries

```traceql
# All errors
{ status = error }

# Slow requests from a service
{ resource.service.name = "frontend" && duration > 1s }

# HTTP 5xx
{ span.http.status_code >= 500 }

# Count errors per trace (>=2)
{ status = error } | count() >= 2

# Select fields
{ status = error } | select(span.http.url, duration, resource.service.name)

# Structural: server span with downstream error
{ kind = server } >> { status = error }

# Both conditions present anywhere
{ span.db.system = "redis" } && { span.db.system = "postgresql" }

# Deterministic most-recent
{ resource.service.name = "api" } with (most_recent=true)
```

## TraceQL metrics

```traceql
# Error rate per service
{ status = error } | rate() by (resource.service.name)

# P99 latency
{ kind = server } | quantile_over_time(duration, .99) by (resource.service.name)
```

## Best-practice notes

- Always include time bounds (`start` / `end`) on search to limit scope
- Use structural operators (`>>`, `&&`) for root-cause patterns
- `attribute != nil` for existence checks
- `with (most_recent=true)` for deterministic recent results
- Scope tag discovery with a TraceQL query to cut noise

License (Apache-2.0)

View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/grafana/skills/blob/main/LICENSE