Engineering Labs

Traces, metrics and logs, correlated, with no application code

Four nginx services observed end to end with OpenTelemetry, using official images only, to show how far correlation between traces, metrics and logs can go before any application is instrumented.

The question#

Teams often postpone observability until every service can be instrumented. How much can a platform provide on its own, with trace context propagated by the proxy layer and signals joined in the collector?

The setup#

   localhost:8088   frontend --+--> catalog
                               +--> orders --> payments
                        |
     every service:     |  spans (OTLP/gRPC)   access logs (syslog, JSON, with trace_id)
                        v
                  OpenTelemetry Collector
                   |         |          |
                traces     logs      metrics
                   v         v          v
                 Tempo     Loki    Prometheus  <-- Tempo also derives request,
                    \        |        /            error and latency metrics
                     Grafana (localhost:3000)

The services are the official nginx-otel image; payments is a few lines of njs that is slow one time in ten and fails one time in twenty. A load generator in the cluster keeps five shoppers browsing and buying.

What it shows#

  • One order is one trace across frontend, orders and payments, because each hop passes the W3C traceparent header on.
  • Logs join traces in the collector. Access logs carry $otel_trace_id; the collector moves it onto the log record, so Grafana can go from a span to its log lines and back.
  • Request, error and latency metrics come from spans. Tempo’s metrics generator produces them, with exemplars that link a point on a latency graph to the request behind it.
  • A failure is visible where it starts and everywhere it spreads. Scaling payments to zero shows the same failure in orders and the frontend, and the trace shows which hop it came from.

Reproduce it#

Docker Desktop with Kubernetes enabled (Git Bash on Windows):

git clone https://github.com/caelus-engineering-labs/k8s-otel-observability.git
cd k8s-otel-observability
./demo.sh                       # then open http://localhost:3000
kubectl -n otel-demo scale deployment/payments --replicas=0

Limits#

A single-node demo cluster with synthetic load. A production design still has to choose sampling, retention and label cardinality, and those choices decide what the dashboards can answer.

Repository