Skip to content

PYTHON-6036 Vendor the OpenTelemetry unified spec tests - #2993

Draft
blink1073 wants to merge 1 commit into
PYTHON-5947-otel-2-transactionsfrom
PYTHON-5947-otel-3-unified
Draft

PYTHON-6036 Vendor the OpenTelemetry unified spec tests#2993
blink1073 wants to merge 1 commit into
PYTHON-5947-otel-2-transactionsfrom
PYTHON-5947-otel-3-unified

Conversation

@blink1073

@blink1073 blink1073 commented Aug 17, 2026

Copy link
Copy Markdown
Member

PYTHON-6036

Third of four PRs splitting #2964. Base is PYTHON-5947-otel-2-transactions.

Branch Contents
1 PYTHON-5947-otel-1-operations operation spans
2 PYTHON-5947-otel-2-transactions transaction spans
3 PYTHON-5947-otel-3-unified unified runner and vendored fixtures (this PR)
4 PYTHON-5947-otel-4-getmore getMore spans

Changes in this PR

Replaces hand-written assertions with the cross-driver spec suite, so the spans from PRs 1 and 2 are checked against the same fixtures every other driver runs.

  • Added observeTracingMessages and expectTracingMessages support to the unified test format runner.
  • Vendored 22 of the spec's 23 tracing fixtures, covering per-operation attributes and nesting for around 20 operations.
  • Added a resync-specs.sh entry to refresh them.
  • Span attribute values are adapted to what the shared match evaluator expects, since they arrive as plain Python primitives rather than BSON-decoded documents.
  • ignoreExtraSpans is enforced at every level of the span tree, not just the top-level array, so a test can assert a span is not nested under a given parent by omitting it.

The getMore fixture is held back for PR 4, which adds the support it needs. The other 22 do not exercise getMore.

Around 4,200 of the 4,600 added lines are resync-specs.sh output and another ~150 are generated mirrors, leaving roughly 190 lines to review.

The 22 vendored fixtures match mongodb/specifications master. Two needed fixing upstream first; both are merged in DRIVERS-3597.

The tree-wide ignoreExtraSpans rule is the one piece here not yet on master: it is specified in DRIVERS-3598 (specifications#1973), still open. PR 4's fixture depends on it, since without it that fixture's negative assertions are unenforceable.

Test Plan

  • The vendored suite: 46 tests pass, 23 each side, with one skip each for mapReduce, whose Collection methods PyMongo removed.
  • Locally against a replica set alongside PRs 1 and 2: 164 tests pass. just lint clean.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

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?

@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 1716de6 to 8e7dd06 Compare August 17, 2026 22:39
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 8e7dd06 to 7592441 Compare August 17, 2026 22:50
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 7592441 to a3455c6 Compare August 17, 2026 23:09
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from a3455c6 to 2649974 Compare August 18, 2026 01:40
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 2649974 to 0089fea Compare August 18, 2026 01:54
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 0089fea to 16dec53 Compare August 18, 2026 02:06
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 16dec53 to af1db36 Compare August 18, 2026 10:22
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from af1db36 to 7042191 Compare August 18, 2026 10:29
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 7042191 to c829156 Compare August 18, 2026 10:44
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from c829156 to 61a201f Compare August 18, 2026 10:47
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 61a201f to 81de518 Compare August 18, 2026 11:06
@blink1073 blink1073 changed the title PYTHON-5947 Vendor the OpenTelemetry unified spec tests PYTHON-6036 Vendor the OpenTelemetry unified spec tests Aug 18, 2026
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from 81de518 to a19a65b Compare August 18, 2026 11:18
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from a19a65b to e374ec0 Compare August 18, 2026 11:42
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from e374ec0 to c969888 Compare August 18, 2026 11:50
Wire observeTracingMessages and expectTracingMessages into the unified test
format runner and vendor the spec's tracing fixtures, plus a resync-specs.sh
entry to refresh them.

Span attributes are plain Python primitives rather than the BSON-decoded
documents the generic match evaluator compares against, so
MatchEvaluatorUtil.match_span_attributes adapts them: ints widen to Int64 so
the $$type "long" alias matches, and db.mongodb.lsid is rebuilt from its
UUID string into the document shape the sessionLsid operator expects.

The getMore fixture is held back for the change that adds getMore spans; the
other 22 do not exercise getMore.
@blink1073
blink1073 force-pushed the PYTHON-5947-otel-3-unified branch from c969888 to ae8c3f0 Compare August 18, 2026 12:02
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.

1 participant