feat: Add OpenTelemetry integration for API service

This change introduces OpenTelemetry dependencies, and uses
`opentelemetry-instrument` auto-instrumentation to allow users to
configure OpenTelemetry settings via environment variables [1].

The only custom environment variable added is
`OTEL_SERVICE_NAME_PREFIX`, which allows users to set a prefix to the
service names included by RomM to differentiate between `api`, `worker`,
and `watcher` services.

The instrumentation of RQ workers and file watcher will be added in
subsequent pull requests.

[1] https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
This commit is contained in:
Michael Manganiello
2025-08-11 23:54:40 -03:00
parent 649a6dc7f7
commit 652df5d4cd
3 changed files with 391 additions and 2 deletions

View File

@@ -89,7 +89,9 @@ start_bin_gunicorn() {
# commands to start our main application and store its PID to check for crashes
info_log "Starting backend"
gunicorn \
opentelemetry-instrument \
--service_name "${OTEL_SERVICE_NAME_PREFIX-}api" \
gunicorn \
--bind=0.0.0.0:5000 \
--bind=unix:/tmp/gunicorn.sock \
--pid=/tmp/gunicorn.pid \