Tracing & logs
See what happened inside a request: logs, traces and metrics shipped to one place and joined by an id.
The CityScript
This is all there is to it. Change it in the editor and the city redraws.
%% T · Tracing & logs
%% Agents on every host ship logs and traces to collectors; Grafana joins them with the request id.
city 48x32
district hosts "Hosts" 3,3..15,17
district telemetry "Telemetry" 20,3..45,17
building shop factory in hosts "Shop app"
floor shop.f "App"
room shop.api service "API" port=8080
room shop.otel worker "OpenTelemetry SDK"
room shop.tail worker "Log tailer"
building db warehouse in hosts "Database"
floor db.f "Postgres"
room db.pg database "Postgres" port=5432
room db.tail worker "Log tailer"
building collector tower in telemetry "Collector"
floor collector.f "Pipeline"
room collector.otel proxy "OTel collector" port=4317,4318
building tempo warehouse in telemetry "Tempo"
floor tempo.f "Traces"
room tempo.store storage "Trace store" port=3200
building loki warehouse in telemetry "Loki"
floor loki.f "Logs"
room loki.store storage "Log store" port=3100
building grafana depot in telemetry "Grafana"
floor grafana.f "Explore"
room grafana.explore service "Logs and traces"
pipeline log-path "Log path" shop -> [tail] -> [parse] -> [ship] -> loki
step shop "The shop writes its log lines"
step loki "The logs are collected, so anyone can search them"
pipeline trace-path "Trace path" shop -> [instrument] -> [sample] -> [export] -> tempo
step shop "A request is followed through the shop"
step tempo "The trace is stored, to see where time was lost"
link shop.otel -> collector.otel "OTLP" variant=emphasis
link collector.otel -> tempo.store "traces"
link grafana.explore -> loki.store "LogQL"
link grafana.explore -> tempo.store "TraceQL"