This package provides opentracing supporting for applications using asyncpg library.
$ pip install asyncpg_opentracing
To activate tracing of SQL commands:
- Wrap your connection class with
tracing_connection
:
from asyncpg.connection import Connection
from asyncpg_opentracing import tracing_connection
@tracing_connection
class MyConnection(Connection):
pass
- Pass it as
connection_class
to theconnect
function:
await asyncpg.connect(user='user', password='password', database='database',
connection_class=MyConnection)
or to the create_pool
function:
await asyncpg.create_pool(user='user', password='password', database='database',
connection_class=MyConnection)