Skip to content

Deploying Grafana Tempo for distributed tracing on AlmaLinux 9 with OTLP + S3 backend

Stand up a Grafana Tempo node on AlmaLinux 9 with OTLP ingest, S3 backend for trace blocks, and Grafana datasource wiring — full installer plus sample OpenTelemetry collector config.

A user reports the checkout flow is slow today. The status page is green. P95 HTTP latency in Prometheus is normal. The logs show 200s. The customer sends a HAR file: the /api/v1/checkout call took 4.3 seconds, and at that exact timestamp your dashboards show nothing anomalous. The next twenty minutes are spent guessing — was it the database, the third-party payment provider, an in-process queue, a slow dependency three hops deep? Without traces, the answer to “where did the time go in that one request” is always a guess. Tempo is what closes that gap: every request emits a tree of spans, you query the trace ID and see exactly which span burned the 3 seconds. On a single-node AlmaLinux 9 box with S3-backed storage, the latency-attribution problem disappears the day you wire it in.

What’s happening

Tempo stores trace data — sequences of timed, structured spans linked by a common trace ID — backed by object storage and queried by trace ID, by attributes (TraceQL), or by service-graph aggregation. It accepts traces over OTLP (HTTP and gRPC), Jaeger, Zipkin, and the legacy thrift formats. A single-binary monolithic deployment scales to tens of thousands of spans per second on a modest VM because trace data is append-only and Tempo writes Parquet blocks directly to S3 — there’s no expensive index to maintain like Jaeger’s Cassandra/Elastic backend.

In production you put an OpenTelemetry Collector in front of Tempo (or several, one per environment). Applications send OTLP to the collector, the collector batches and re-forwards to Tempo. Trace sampling lives in the collector — you sample at the edge, not in the application, so changing sample rates doesn’t require a redeploy. Tempo then exposes a query API that Grafana hits as a datasource. Trace-to-logs and trace-to-metrics correlation in Grafana means you can click a span and jump directly to the matching log line in Loki or the matching metric in Mimir, which is what makes the whole observability stack worth the trouble.

How to verify

Tempo is healthy:

curl -s http://10.30.0.21:3200/ready
# expect: ready
curl -s http://10.30.0.21:3200/status/version

Trace ingestion is working — send a synthetic span via the OTLP HTTP endpoint:

TRACE_ID=$(openssl rand -hex 16)
SPAN_ID=$(openssl rand -hex 8)
NOW_NS=$(date +%s%N)
END_NS=$(($NOW_NS + 50000000))

curl -X POST http://10.30.0.21:4318/v1/traces \
  -H 'Content-Type: application/json' \
  -d @- <<EOF
{
  "resourceSpans":[{
    "resource":{"attributes":[{"key":"service.name","value":{"stringValue":"synthetic"}}]},
    "scopeSpans":[{"spans":[{
      "traceId":"${TRACE_ID}",
      "spanId":"${SPAN_ID}",
      "name":"GET /health",
      "kind":2,
      "startTimeUnixNano":"${NOW_NS}",
      "endTimeUnixNano":"${END_NS}"
    }]}]
  }]
}
EOF

# Query it back
sleep 5
curl -s "http://10.30.0.21:3200/api/traces/${TRACE_ID}" | jq '.batches[0].scopeSpans[0].spans[0].name'
# expect: "GET /health"

Confirm blocks are landing in S3:

aws --endpoint-url https://s3.fr-par.scw.cloud s3 ls s3://acme-tempo-traces/single-tenant/ \
  | head -10

The fix

Save as /root/setup-tempo.sh and run on the single Tempo VM. The script installs Tempo 2.5, configures OTLP HTTP + gRPC ingestion, points block storage at S3, sets up an OpenTelemetry Collector on the same host as a sidecar (in production you put it on the app boxes), and fronts everything with NGINX for TLS.

#!/usr/bin/env bash
set -euo pipefail

### AlmaLinux 9 Grafana Tempo + OpenTelemetry Collector installer
### Single-node, S3-backed, OTLP ingest on 4317 (gRPC) / 4318 (HTTP)

if [[ "$(id -u)" -ne 0 ]]; then
  echo "Run as root."
  exit 1
fi

# === EDIT ===
NODE_IP="10.30.0.21"
TEMPO_VERSION="2.5.0"
OTELCOL_VERSION="0.103.0"
S3_ENDPOINT="s3.fr-par.scw.cloud"
S3_REGION="fr-par"
S3_BUCKET="acme-tempo-traces"
S3_ACCESS_KEY="CHANGE_ME_ACCESS"
S3_SECRET_KEY="CHANGE_ME_SECRET"
PUBLIC_DOMAIN="tempo.example.com"
# =============

echo
echo "========================================"
echo "Tempo node ${NODE_IP}"
echo "========================================"

echo "==> Updating base OS"
dnf -y update
dnf -y install epel-release
dnf -y install vim curl wget chrony fail2ban dnf-automatic \
  policycoreutils-python-utils lsof tcpdump bind-utils tar gzip \
  iproute net-tools jq socat firewalld nginx certbot python3-certbot-nginx \
  openssl htop iotop

systemctl enable --now chronyd
systemctl enable --now firewalld

echo "==> Firewall rules"
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
# OTLP ingest from app/collector boxes only — restrict source as needed
firewall-cmd --permanent --add-port=4317/tcp
firewall-cmd --permanent --add-port=4318/tcp
firewall-cmd --reload

echo "==> SELinux enforcing"
sed -i 's/^SELINUX=.*/SELINUX=enforcing/' /etc/selinux/config
setenforce 1 || true
setsebool -P httpd_can_network_connect 1

echo "==> SSH hardening"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart sshd

echo "==> fail2ban + automatic security updates"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban

cat > /etc/dnf/automatic.conf <<'DNFAUTO'
[commands]
upgrade_type = security
random_sleep = 900
download_updates = yes
apply_updates = yes
[emitters]
emit_via = stdio
DNFAUTO
systemctl enable --now dnf-automatic.timer

echo "==> Sysctl"
cat > /etc/sysctl.d/99-tempo.conf <<'SYSCTL'
fs.file-max = 2097152
net.core.somaxconn = 8192
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.ip_local_port_range = 10240 65535
vm.max_map_count = 262144
SYSCTL
sysctl --system

cat > /etc/security/limits.d/99-tempo.conf <<'LIMITS'
tempo soft nofile 200000
tempo hard nofile 200000
LIMITS

echo "==> Creating tempo user"
id -u tempo >/dev/null 2>&1 || useradd --system --no-create-home --shell /sbin/nologin tempo
mkdir -p /var/lib/tempo/wal /var/lib/tempo/blocks /etc/tempo
chown -R tempo:tempo /var/lib/tempo /etc/tempo

echo "==> Downloading Tempo ${TEMPO_VERSION}"
cd /tmp
wget -q "https://github.com/grafana/tempo/releases/download/v${TEMPO_VERSION}/tempo_${TEMPO_VERSION}_linux_amd64.tar.gz"
tar xzf "tempo_${TEMPO_VERSION}_linux_amd64.tar.gz"
install -o root -g root -m 0755 tempo /usr/local/bin/tempo
/usr/local/bin/tempo --version

echo "==> Writing tempo.yml"
cat > /etc/tempo/tempo.yml <<EOF
stream_over_http_enabled: true
server:
  http_listen_port: 3200
  grpc_listen_port: 9095
  log_level: info

distributor:
  receivers:
    otlp:
      protocols:
        http:
          endpoint: 0.0.0.0:4318
        grpc:
          endpoint: 0.0.0.0:4317
    jaeger:
      protocols:
        thrift_http:
          endpoint: 0.0.0.0:14268
    zipkin:
      endpoint: 0.0.0.0:9411

ingester:
  trace_idle_period: 10s
  max_block_duration: 5m

compactor:
  compaction:
    block_retention: 720h   # 30 days; raise as budget allows

metrics_generator:
  registry:
    external_labels:
      source: tempo
  storage:
    path: /var/lib/tempo/generator/wal
  traces_storage:
    path: /var/lib/tempo/generator/traces

storage:
  trace:
    backend: s3
    s3:
      bucket: ${S3_BUCKET}
      endpoint: ${S3_ENDPOINT}
      region: ${S3_REGION}
      access_key: ${S3_ACCESS_KEY}
      secret_key: ${S3_SECRET_KEY}
      insecure: false
    wal:
      path: /var/lib/tempo/wal
    pool:
      max_workers: 100
      queue_depth: 10000

overrides:
  defaults:
    metrics_generator:
      processors: [service-graphs, span-metrics]
    ingestion:
      max_traces_per_user: 100000
      rate_limit_bytes: 25000000
      burst_size_bytes: 50000000
EOF
chown -R tempo:tempo /etc/tempo

echo "==> Tempo systemd unit"
cat > /etc/systemd/system/tempo.service <<'UNIT'
[Unit]
Description=Grafana Tempo
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=tempo
Group=tempo
ExecStart=/usr/local/bin/tempo -config.file=/etc/tempo/tempo.yml
Restart=on-failure
RestartSec=5s
LimitNOFILE=200000
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable --now tempo

echo "==> Installing OpenTelemetry Collector"
cd /tmp
wget -q "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTELCOL_VERSION}/otelcol-contrib_${OTELCOL_VERSION}_linux_amd64.rpm"
dnf -y install "./otelcol-contrib_${OTELCOL_VERSION}_linux_amd64.rpm"

cat > /etc/otelcol-contrib/config.yaml <<'OTEL'
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:14317
      http:
        endpoint: 0.0.0.0:14318

processors:
  batch:
    timeout: 10s
    send_batch_size: 1024
  memory_limiter:
    check_interval: 5s
    limit_mib: 1024
    spike_limit_mib: 256
  tail_sampling:
    decision_wait: 10s
    num_traces: 50000
    expected_new_traces_per_sec: 1000
    policies:
      - name: errors
        type: status_code
        status_code: {status_codes: [ERROR]}
      - name: slow
        type: latency
        latency: {threshold_ms: 500}
      - name: sample-rest
        type: probabilistic
        probabilistic: {sampling_percentage: 5}

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

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, tail_sampling, batch]
      exporters: [otlp/tempo]
OTEL

systemctl enable --now otelcol-contrib

echo "==> NGINX with TLS termination for query API"
cat > /etc/nginx/conf.d/tempo.conf <<EOF
upstream tempo_http { server 127.0.0.1:3200; keepalive 32; }

server {
  listen 80;
  server_name ${PUBLIC_DOMAIN};
  location /.well-known/acme-challenge/ { root /var/www/html; }
  location / { return 301 https://\$host\$request_uri; }
}

server {
  listen 443 ssl http2;
  server_name ${PUBLIC_DOMAIN};
  ssl_certificate /etc/letsencrypt/live/${PUBLIC_DOMAIN}/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/${PUBLIC_DOMAIN}/privkey.pem;
  ssl_protocols TLSv1.2 TLSv1.3;

  proxy_read_timeout 120s;
  client_max_body_size 50m;

  location / {
    proxy_set_header Host \$host;
    proxy_pass http://tempo_http;
  }
}
EOF

mkdir -p /var/www/html
nginx -t && systemctl enable --now nginx

echo "==> Waiting for Tempo /ready"
for i in {1..60}; do
  if curl -fs "http://127.0.0.1:3200/ready" >/dev/null 2>&1; then break; fi
  sleep 2
done

echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Listeners:"
ss -lntp | grep -E ':(80|443|3200|4317|4318|9095|14317|14318|14268|9411)\b' || true
echo
echo "Send your first OTLP trace from any host:"
echo "  curl -X POST http://${NODE_IP}:4318/v1/traces -H 'Content-Type: application/json' -d @trace.json"
echo
echo "Run certbot --nginx -d ${PUBLIC_DOMAIN} once DNS is pointed."

In Grafana, add the Tempo datasource:

# /etc/grafana/provisioning/datasources/tempo.yaml
apiVersion: 1
datasources:
  - name: Tempo
    type: tempo
    access: proxy
    url: https://tempo.example.com
    jsonData:
      tracesToLogsV2:
        datasourceUid: loki
        spanStartTimeShift: '-5m'
        spanEndTimeShift: '5m'
        tags: [{key: 'service.name', value: 'service'}]
      tracesToMetrics:
        datasourceUid: mimir
        tags: [{key: 'service.name', value: 'service'}]
      nodeGraph:
        enabled: true
      serviceMap:
        datasourceUid: mimir

On the application side, point your OTLP SDK at the collector — never directly at Tempo. The collector handles sampling, batching, and back-pressure during ingest spikes. A minimal Node.js example:

// app/tracing.js
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');

const sdk = new NodeSDK({
  serviceName: 'checkout-api',
  traceExporter: new OTLPTraceExporter({
    url: 'grpc://otelcol.internal:14317',
  }),
  instrumentations: [getNodeAutoInstrumentations()],
});

sdk.start();

The serviceName becomes the dominant grouping in Tempo — keep it stable across deploys or your service graph fragments. Watch tempo_distributor_spans_received_total and tempo_distributor_spans_received_bytes_total to spot ingest spikes. If you see tempo_ingester_failed_flushes_total increment, S3 is rejecting writes (almost always credentials or bucket policy).

Run distributed tracing on Stack Harbor’s managed cloud compute with object-storage lifecycle policies and trace-to-logs wiring tuned for your stack — or scope it with us if you’d like the observability tier delivered as a service.