opentelemetry-instrumentation-aiopg
OpenTelemetry aiopg instrumentation
What it is and what it does
This package integrates OpenTelemetry tracing into aiopg, the async PostgreSQL driver for Python. When installed and initialized, it automatically wraps aiopg database calls to emit spans—structured records of database operations—that can be exported to observability platforms for monitoring, debugging, and performance analysis.
It sits between your application and aiopg, intercepting queries and connections to record timing, status, and query details. The instrumentation depends on opentelemetry-instrumentation-dbapi for shared database tracing logic and wrapt for non-invasive function wrapping. It is currently in beta (version 0.65b0) and requires Python 3.10 or later.
Use it for:
- Monitor query latency and database operation timing in async web applications using aiopg.
- Correlate database calls with HTTP requests and other services in distributed tracing systems.
- Debug slow or failing database operations by examining detailed spans in a tracing backend.
- Track database connection pool behavior and identify bottlenecks in async workloads.
- Export database metrics to observability platforms like Jaeger or Datadog for centralized monitoring.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds distributed tracing instrumentation for aiopg, an async PostgreSQL driver, to automatically capture and export database operations as OpenTelemetry spans.
Yes, if you use aiopg in an async application and need distributed tracing. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it safe to adopt. The beta status is not a blocker—it reflects ongoing refinement, not instability. Install it if observability of your async database layer is a priority; skip it if you have no tracing infrastructure or do not use aiopg.
Install
opentelemetry-instrumentation-aiopg on PyPI
pip
pip install opentelemetry-instrumentation-aiopguv
uv add opentelemetry-instrumentation-aiopgpoetry
poetry add opentelemetry-instrumentation-aiopgInstalling opentelemetry-instrumentation-aiopg
Before you install
Low install friction with four runtime dependencies. Actively maintained as of 2026-08-14 with recent releases. Beta status (0.65b0) indicates the instrumentation is still stabilizing but usable.
License in practice
Apache-2.0 permissive license allows use in commercial and open-source projects with minimal restrictions beyond attribution.
Quickstart
pip install opentelemetry-instrumentation-aiopg
from opentelemetry.instrumentation.aiopg import AiopgInstrumentor
AiopgInstrumentor().instrument()
Requires Python 3.10 or later; aiopg must be installed and used in an async context; an OpenTelemetry exporter must be configured separately to send traces.
Verify before relying
- Whether instrumentation works with all aiopg connection pool patterns or only direct connections.
- Performance overhead of tracing in high-throughput async database workloads.
- Compatibility with specific OpenTelemetry exporter backends (Jaeger, Datadog, etc.).
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — opentelemetry-api, opentelemetry-instrumentation-dbapi, opentelemetry-instrumentation, wrapt |
| Maintenance | actively maintained — 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,285,352/month — #2,673 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_aiopg-0.65b0-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-asyncpgAdds distributed tracing to PostgreSQL queries…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-mysqlAdds distributed tracing to MySQL database…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-aiokafkaAdds distributed tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-psycopg2Adds distributed tracing instrumentation to…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-aio-pikaAdds distributed tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-psycopgAdds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-sqlalchemyAdds distributed tracing to SQLAlchemy database…
permissive · top 1,000 on PyPI
aiopgaiopg provides asyncio-based access to…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-cassandraAdds distributed tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-redisAdds distributed tracing to Redis client calls…
permissive · top 1,000 on PyPI