Description
Add OpenTelemetry auto-instrumentation to acapy-agent to enable distributed tracing and application metrics for HTTP endpoints and PostgreSQL queries.
Requirements
- Add
opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp, opentelemetry-instrumentation-aiohttp-server to dependencies in pyproject.toml
- Initialize OTel SDK in
acapy_agent/commands/start.py inside run_app(), before conductor.setup() — not in __main__.py (that file is a thin debug/dispatch wrapper only); set up both TracerProvider and MeterProvider with OTLP exporters
- Add aiohttp server instrumentation in
acapy_agent/admin/server.py → make_application() where the middleware list is built
- Add PostgreSQL tracing via
opentelemetry-instrumentation-psycopg (psycopg v3); instrument at pool creation in acapy_agent/database_manager/databases/postgresql_normalized/connection_pool.py
Acceptance Criteria
Description
Add OpenTelemetry auto-instrumentation to acapy-agent to enable distributed tracing and application metrics for HTTP endpoints and PostgreSQL queries.
Requirements
opentelemetry-api,opentelemetry-sdk,opentelemetry-exporter-otlp,opentelemetry-instrumentation-aiohttp-serverto dependencies inpyproject.tomlacapy_agent/commands/start.pyinsiderun_app(), beforeconductor.setup()— not in__main__.py(that file is a thin debug/dispatch wrapper only); set up bothTracerProviderandMeterProviderwith OTLP exportersacapy_agent/admin/server.py→make_application()where the middleware list is builtopentelemetry-instrumentation-psycopg(psycopg v3); instrument at pool creation inacapy_agent/database_manager/databases/postgresql_normalized/connection_pool.pyAcceptance Criteria
http.server.request.durationhistogram) appear in Mimir