PYTHON-5993 Add OpenTelemetry operation spans for cursor getMores - #2994
Draft
blink1073 wants to merge 1 commit into
Draft
PYTHON-5993 Add OpenTelemetry operation spans for cursor getMores#2994blink1073 wants to merge 1 commit into
blink1073 wants to merge 1 commit into
Conversation
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 17, 2026 22:39
deba5ab to
3406414
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 17, 2026 22:50
3406414 to
a8961f2
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 17, 2026 23:09
a8961f2 to
bd799e7
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 01:40
bd799e7 to
f407469
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 01:54
f407469 to
5c8726d
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 02:06
5c8726d to
c89b279
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 10:22
c89b279 to
25760c0
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
2 times, most recently
from
August 18, 2026 10:35
09b8a1a to
55f6ad7
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 10:44
55f6ad7 to
ab27a41
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 10:47
ab27a41 to
31efdcf
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 11:06
31efdcf to
5fddbd6
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 11:18
5fddbd6 to
5387bd4
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 11:43
5387bd4 to
4faf2b4
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 11:50
4faf2b4 to
8a8720e
Compare
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 12:02
8a8720e to
d6b1d17
Compare
Give each caller-driven getMore an operation span of its own, as the specification requires: the application may do unrelated work between batches, so nesting them under the operation that created the cursor would misrepresent the timing. A public API call that creates a cursor and drains it itself, such as list_collection_names or index_information, is the exception. Those mark the block with internal_cursor_iteration(), and every getMore inside it belongs to that call's single operation span. The client bulk-write results cursor is a second exception, reusing the enclosing bulkWrite span rather than creating spurious siblings. Change streams deliberately get neither treatment: they can tail indefinitely, so a span covering the whole lifetime would never end. Also vendors the getMore spec fixture, the one fixture that needs this support.
blink1073
force-pushed
the
PYTHON-5947-otel-4-getmore
branch
from
August 18, 2026 12:56
d6b1d17 to
f8db897
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PYTHON-5993
Last of four PRs splitting #2964. Base is
PYTHON-5947-otel-3-unified.PYTHON-5947-otel-1-operationsPYTHON-5947-otel-2-transactionsPYTHON-5947-otel-3-unifiedPYTHON-5947-otel-4-getmoreChanges in this PR
Gives each caller-driven
getMorean operation span of its own, which the specification requires: an application may do unrelated work between batches, so nesting everygetMoreunder the call that created the cursor would misrepresent the timing.Implements DRIVERS-3598 (specifications#1973), which settles this: the spec previously said only that a command span nests under "the corresponding driver operation span", which is unambiguous only while an operation sends one command. Both readings passed the suite because no fixture exercised
getMore.list_collection_namesorindex_information, keeps a single span covering everygetMoreit sends.db.mongodb.cursor_idholds the id the driver sent, even when the reply returns0, and is omitted rather than reported as0for a cursor-creating command that leaves no cursor open.bulkWritespan instead of adding spurious siblings.getMorefixture, held back from PR 3, plus its prose tests 3 and 4 for what the unified format cannot express.Change streams deliberately get neither treatment. A change stream can tail indefinitely, so a span covering its lifetime would never end or be exported; each
getMoregets a short-lived sibling span instead. There is a comment on the code saying so.The fixture is a local deviation until specifications#1973 merges.
get_more.jsonis not onmongodb/specificationsmaster yet, so runningresync-specs.shbefore that lands will delete it. The file here is byte-identical to the spec PR. That PR's tree-wideignoreExtraSpansrule, which this fixture's negative assertions rely on, is in PR 3.Completes the split: this branch's tree is identical to #2964 apart from a
.gitignoreentry for local worktrees, which the stack drops.Test Plan
getMore, single-span coverage for internally drained cursors, bulk-write cursor nesting, cursors abandoned part-way, change-stream namespaces, and the spec's prose tests 3 and 4.getMorefixture, which passes unmodified. It caught a real divergence on its first run: the driver had used a single cursor-lifetime span, the reading DRIVERS-3598 rules out.mockupdbnot being installed, and one timing-sensitive test, andotelreproduces the same set unchanged.just lintclean.Checklist
Checklist for Author
Checklist for Reviewer