Telemetry

[object Object]

Hubstruct records what it does with OpenTelemetry and sends it to a Grafana stack that runs beside it in Compose: Tempo for traces, Prometheus for metrics and Loki for logs, in one otel-lgtm container. It's on by default.

Open Grafana at http://localhost:3001 (user admin, password admin; GRAFANA_PORT moves it). It's published on the machine itself only.

What's recorded

  • Traces. Each page the app draws, each API request, each step run and each pass of the worker's schedulers (an album refresh, the people pass) is a trace. Under it: every database query, and every call to the models server, the vision service and storage it made. A page's trace carries on into the API's, so one trace shows a slow page from end to end.
  • Metrics. Requests by route, status and time taken; step runs by step and outcome (done, error to retry, failed for good) and their run times; the database's connections and query times.
  • Logs. Every service's log lines, as they appear in docker compose logs, with the trace they belong to. In Grafana, a log line links to its trace and a trace to its log lines.

The Hubstruct dashboard (under Dashboards) puts the main ones together: API requests and their slowest routes, step runs and their times, and recent logs. Explore has the rest: pick Tempo to search traces (by service, name or how long they took), Loki for logs, Prometheus for any metric.

Health checks and the app's own files (scripts, styles, icons) aren't recorded.

Turning it off

Set OTEL_SDK_DISABLED=true in .env and docker compose up -d. The services record nothing and send nothing; logs still go to docker compose logs. To stop Grafana too, docker compose stop otel-lgtm.

Sending it somewhere else

Point OTEL_EXPORTER_OTLP_ENDPOINT at any OpenTelemetry collector or backend that takes OTLP over HTTP (Grafana Cloud, Honeycomb, your own collector). The standard OTEL_* variables apply too, such as OTEL_EXPORTER_OTLP_HEADERS for a key, or OTEL_TRACES_SAMPLER to keep only some traces.

The bundled stack is for running Hubstruct on one machine: it keeps what it's sent in the otel_lgtm volume, with no retention limits tuned for months of data.