OpenTelemetry pymongo integration¶
The integration with MongoDB supports the pymongo library and is specified
to trace_integration
using 'pymongo'
.
Usage¶
from pymongo import MongoClient
from opentelemetry.trace import tracer_provider
from opentelemetry.trace.ext.pymongo import trace_integration
trace_integration(tracer_provider())
client = MongoClient()
db = client["MongoDB_Database"]
collection = db["MongoDB_Collection"]
collection.find_one()
References¶
Module contents¶
The opentelemetry-ext-pymongo package allows tracing commands made by the pymongo library.
-
opentelemetry.ext.pymongo.
trace_integration
(tracer=None)[source]¶ Integrate with pymongo to trace it using event listener. https://api.mongodb.com/python/current/api/pymongo/monitoring.html