Docs menuFeatures

DOCS / FEATURES

Observability

The API writes structured tracing logs tagged with a per-request id, can export OpenTelemetry traces, exposes a health check, and shuts down gracefully. Code: api/src/telemetry.rs (subscriber setup), api/src/routes.rs (request ids, the request span, and the health check), and api/src/main.rs (shutdown).

Structured logs

Logging uses tracing throughout and is always on. RUST_LOG controls filtering (default info when unset):

bash
RUST_LOG=api=debug,tower_http=info,info   # development (.env.example)
RUST_LOG=api=info,tower_http=warn,info    # production (fly.toml, compose)

Services log with structured fields (org, user, subscription, job, kind), so lines are filterable in any log backend. Every 5xx response is logged at error level with its full error chain. For a 500 the client gets only a generic message, while a 503 such as not_configured keeps its readable one.

Request ids

Every request gets an id in the x-request-id header:

  • If the caller sends one that looks like an id (1 to 64 characters of ASCII letters, digits, -, _, or .), it's kept. That helps behind a gateway that already assigns ids.
  • Anything else (empty, too long, newlines, arbitrary text) is dropped and a fresh UUID is minted, so the value reaching logs can't be used for log injection or bloat.
  • The id names the request's tracing span (http{method=... path=... request_id=...}), so each log line emitted while handling the request carries it.
  • It's copied onto the response, error responses included.

[ full guide ]

The rest of this guide comes with the repo.

  • Server timing
  • Traces (OpenTelemetry)
  • Error tracking
  • Health check
  • Graceful shutdown
  • Useful signals in the logs
Get LaunchCrate