Skip to main content

PyMongo OpenTracing

This package enables tracing Mongo commands in a PyMongo MongoClient via The OpenTracing Project. Once a production system contends with real concurrency or splits into many services, crucial (and formerly easy) tasks become difficult: user-facing latency optimization, root-cause analysis of backend errors, communication about distinct pieces of a now-distributed system, etc. Distributed tracing follows a request on its journey from inception to completion from mobile/browser all the way to the microservices.

As core services and libraries adopt OpenTracing, the application builder is no longer burdened with the task of adding basic tracing instrumentation to their own code. In this way, developers can build their applications with the tools they prefer and benefit from built-in tracing instrumentation. OpenTracing implementations exist for major distributed tracing systems and can be bound or swapped with a one-line configuration change.

If you want to learn more about the underlying Python API, visit the Python source code.

Installation

Run the following command:

$ pip install pymongo-opentracing

Usage

This PyMongo monitor allows the tracing of database queries and commands using the OpenTracing API. All that it requires is for a CommandTracing listener instance to be initialized using an instance of an OpenTracing tracer and registered via the pymongo.monitoring module.

Initialize

CommandTracing takes the Tracer instance that is supported by OpenTracing and an optional dictionary of desired tags for each created span. To create a CommandTracing object, you can either pass in a tracer object directly or default to the opentracing.tracer global tracer that’s set elsewhere in your application:

from pymongo_opentracing import CommandTracing
from pymongo import monitoring

opentracing_tracer = ## some OpenTracing tracer implementation
# All future clients will have CommandTracing registered for their events
monitoring.register(CommandTracing(opentracing_tracer,
                                   span_tags={'MyCustomTag': 'HelpfulVal'}))

or

from pymongo_opentracing import CommandTracing
import opentracing
import pymongo

opentracing.tracer = ## some OpenTracing tracer implementation
# Only this client will have CommandTracing trace their events
client = pymongo.MongoClient(event_listeners=[CommandTracing()])

Further Information

If you’re interested in learning more about the OpenTracing standard, please visit opentracing.io or join the mailing list. If you would like to implement OpenTracing in your project and need help, feel free to send us a note at community@opentracing.io.

Metadata

Release files for PyMongo-OpenTracing 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for PyMongo-OpenTracing 0.0.3
File Interpreter ABI Platform
PyMongo_OpenTracing-0.0.3-py3-none-any.whl Python 3 none any Details

Release files / PyMongo_OpenTracing-0.0.3-py3-none-any.whl

Download URL PyMongo_OpenTracing-0.0.3-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f390e522db8792c06f7c4517f73237324fb339cd809a506295fde1925fd5f20
BLAKE2b-256 checksum
How to use checksums
c17de1d200c1e09f9798c10f82510237da14fc5bdb98d1518f36fac13eded229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page