Skip to content

PYTHON-5745 Consolidate command telemetry#2891

Open
blink1073 wants to merge 4 commits into
mongodb:masterfrom
blink1073:PYTHON-5745
Open

PYTHON-5745 Consolidate command telemetry#2891
blink1073 wants to merge 4 commits into
mongodb:masterfrom
blink1073:PYTHON-5745

Conversation

@blink1073

@blink1073 blink1073 commented Jun 24, 2026

Copy link
Copy Markdown
Member

PYTHON-5745

Changes in this PR

Introduces pymongo/_telemetry.py with a _CommandTelemetry class that unifies structured logging and APM event publishing for command lifecycle events into a single internal API. This refactor is a stepping stone to adding OpenTelemetry support in a _telemetry.py, so all event-related handling is in one centralized location.

Test Plan

No new tests: this is a behavior-preserving refactor. The existing APM / command-monitoring and command-logging spec suites assert the exact event and log documents that any regression would change.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? — Not necessary; internal refactor with no user-facing behavior change.
  • Is there test coverage? — Covered by existing spec suites (behavior preserved).
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). — PYTHON-5846 will extend this pattern to cover the remaining logging and APM event types.

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@blink1073 blink1073 marked this pull request as ready for review June 24, 2026 20:47
@blink1073 blink1073 requested a review from a team as a code owner June 24, 2026 20:47
@blink1073 blink1073 requested a review from NoahStapp June 24, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants