OpenTelemetry pymongo Instrumentation¶
The integration with MongoDB supports the pymongo library, it can be
enabled using the PymongoInstrumentor
.
Usage¶
from pymongo import MongoClient
from opentelemetry import trace
from opentelemetry.trace import TracerProvider
from opentelemetry.instrumentation.pymongo import PymongoInstrumentor
trace.set_tracer_provider(TracerProvider())
PymongoInstrumentor().instrument()
client = MongoClient()
db = client["MongoDB_Database"]
collection = db["MongoDB_Collection"]
collection.find_one()