-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Logging, Monitoring
-
None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Context
PYTHON-5744 has exposed that we duplicate a huge amount of code for logging and event publishing. Many pieces of data are passed multiple times within the same function, often with only one or two fields differing between logging/event hooks. This produces many lines of code that clutter the driver's codebase and reduce readability. By consolidating this handling into a single internal API accessed through a unified telemetry call, we can reduce code duplication and significantly improve clarity. Doing so will also make adding OpenTelemetry support in PYTHON-5052 much more straightforward.
Definition of done
All event publishing and logging calls are refactored to be within a shared telemetry API that publishes both types of monitoring data. All existing event/logging calls use this new API wherever possible instead of direct calls to event publishing or logging.
A PoC of what this might look like (limited to only command logging/events) is here: https://github.com/mongodb/mongo-python-driver/pull/2720.
Pitfalls
The refactor cannot change any external logging or event publishing behavior. No performance regressions must occur as a result of this refactor.
- split from
-
PYTHON-5744 [Spike] Client Side Support for OpenTelemetry
-
- In Code Review
-