opentelemetry-instrumentation-pymongo
OpenTelemetry pymongo instrumentation
What it is and what it does
This package integrates pymongo with OpenTelemetry, the industry-standard observability framework. It automatically captures database operations as distributed traces, allowing you to see MongoDB queries alongside other application telemetry in your observability backend. The instrumentation depends on opentelemetry-api, opentelemetry-instrumentation, and opentelemetry-semantic-conventions to provide the tracing infrastructure.
It's designed for applications that already use OpenTelemetry for application-wide observability and need to extend that visibility into their MongoDB layer. Once installed and initialized, it intercepts pymongo calls and emits spans with operation details, timing, and status information compatible with standard OpenTelemetry exporters.
Use it for:
- Add MongoDB query tracing to a microservice already instrumented with OpenTelemetry.
- Correlate slow database operations with application performance issues in a distributed system.
- Export pymongo activity to a centralized observability platform like Jaeger or Datadog.
- Debug application behavior by viewing the full trace of database operations in context.
- Monitor database performance and query patterns across your fleet of services.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds automatic tracing and observability instrumentation for pymongo database operations, capturing MongoDB queries and performance metrics for OpenTelemetry.
Yes, if you are already using OpenTelemetry in your application and need to instrument pymongo. The package is actively maintained, has low install friction, and carries a permissive license. The beta version status warrants checking release notes before production use, but the recent activity and top-5000 popularity suggest it is stable enough for most use cases.
Install
opentelemetry-instrumentation-pymongo on PyPI
pip
pip install opentelemetry-instrumentation-pymongouv
uv add opentelemetry-instrumentation-pymongopoetry
poetry add opentelemetry-instrumentation-pymongoInstalling opentelemetry-instrumentation-pymongo
Before you install
Low friction install with three stable runtime dependencies. Active maintenance as of 2026-07-16, repository shows recent activity.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install opentelemetry-instrumentation-pymongo
from opentelemetry.instrumentation.pymongo import PymongoInstrumentor
PymongoInstrumentor().instrument()
Requires Python 3.10 or later; pymongo must be installed separately in your application.
Verify before relying
- Whether this package automatically instruments existing pymongo connections or requires explicit setup per connection.
- What span attributes and metrics are captured for different pymongo operations (find, insert, update, delete).
- Whether the beta status (0.65b0) indicates known limitations or breaking changes expected before 1.0.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions |
| Maintenance | actively maintained — 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,413,763/month — #2,105 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_pymongo-0.65b0-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-psycopgAdds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pymssqlAdds automatic tracing and monitoring of…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-jinja2Adds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-celeryAdds distributed tracing and observability to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pyramidAdds automatic tracing and metrics collection…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pymysqlAdds OpenTelemetry tracing instrumentation to…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-remouladeAdds distributed tracing instrumentation for…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-djangoAdds distributed tracing to Django applications…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-system-metricsCollects system performance metrics (CPU,…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-elasticsearchAdds distributed tracing to Elasticsearch…
permissive · top 5,000 on PyPI