OpenTelemetry Instrumentation for Python
Provides automatic instrumentation tools for OpenTelemetry in Python, enabling seamless tracing and monitoring of Python applications. Current version: 0.61b0. Release cadence: Regular updates with new features and support for additional Python versions.
Warnings
- breaking The 'instrumentation' module has been refactored; ensure imports are updated accordingly.
- gotcha Automatic instrumentation may not support all third-party libraries out of the box.
Install
-
pip install opentelemetry-instrumentation
Imports
- BaseInstrumentor
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
Quickstart
import os from opentelemetry.instrumentation.asgi import AsgiInstrumentor from opentelemetry.instrumentation.wsgi import WSGIInstrumentor # Initialize instrumentation AsgiInstrumentor().instrument() WSGIInstrumentor().instrument() # Your application code here # For example, using ASGI: # app = ... # app.run() # For WSGI: # from wsgi_app import app # app.run()