Opentelemetry asyncpg Instrumentation

Module contents

This library allows tracing PostgreSQL queries made by the asyncpg library.

Usage

import asyncpg
from opentelemetry.instrumentation.asyncpg import AsyncPGInstrumentor

# You can optionally pass a custom TracerProvider to AsyncPGInstrumentor.instrument()
AsyncPGInstrumentor().instrument()
conn = await asyncpg.connect(user='user', password='password',
                             database='database', host='127.0.0.1')
values = await conn.fetch('''SELECT 42;''')

API

class opentelemetry.instrumentation.asyncpg.AsyncPGInstrumentor(capture_parameters=False)[source]

Bases: opentelemetry.instrumentation.instrumentor.BaseInstrumentor