forked from mtusi2026/mtusi2026lab2
Start the telemetry in create_app, which gunicorn runs in every worker after fork because preload_app is off, and in the relay and worker processes with their own service names, and stop it after the rest of the shutdown within TELEMETRY_SHUTDOWN_SECONDS. The API gets server spans and the http.server.request.duration histogram in seconds from the FastAPI instrumentation with stable HTTP semantic conventions, without /health probes and without the internal send and receive spans, and the request pipeline puts X-Request-Id on the server span as messenger.request_id. The worker broker gets the FastStream RabbitTelemetryMiddleware, so every delivery runs inside a consumer span. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>