skillfed

opentelemetry-instrumentation-pymongo

OpenTelemetry pymongo instrumentation

opentelemetry-instrumentation-pymongo v0.65b0 5.4M downloads/30d#2,105 on PyPI1,086
Permissive license Apache-2.0 Active released

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-pymongo

uv

uv add opentelemetry-instrumentation-pymongo

poetry

poetry add opentelemetry-instrumentation-pymongo

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

pymongo tracingmongodb observabilityopentelemetry instrumentationdatabase query monitoringpymongo performance metricsmongodb span collectiondistributed tracing mongodb
observabilitydistributed-tracingmongodb

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-psycopg

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-pymssql

Adds automatic tracing and monitoring of…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-jinja2

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-celery

Adds distributed tracing and observability to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-pyramid

Adds automatic tracing and metrics collection…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-pymysql

Adds OpenTelemetry tracing instrumentation to…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-remoulade

Adds distributed tracing instrumentation for…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-django

Adds distributed tracing to Django applications…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-system-metrics

Collects system performance metrics (CPU,…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-elasticsearch

Adds distributed tracing to Elasticsearch…

permissive · top 5,000 on PyPI