Skip to content

Commit 78723c5

Browse files
committed
PYTHON-5947 Tighten the OpenTelemetry changelog and docstring entries
Both had grown by accretion across two rounds of work, reading as a base description followed by a list of later additions. Describe the feature as it ships instead.
1 parent f40a62d commit 78723c5

3 files changed

Lines changed: 15 additions & 33 deletions

File tree

doc/changelog.rst

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,15 @@ PyMongo 4.18 brings a number of changes including:
2020
attempts, so consumers can correlate a retried operation's events. As a
2121
result, ``operation_id`` is no longer equal to the per-attempt ``request_id``
2222
for these operations.
23-
- Added optional OpenTelemetry command, operation, and transaction span
24-
support, conforming to the
23+
- Added optional OpenTelemetry tracing support, conforming to the
2524
`OpenTelemetry driver specification <https://github.com/mongodb/specifications/blob/master/source/open-telemetry/open-telemetry.md>`_.
26-
Enable it with the ``tracing`` :class:`~pymongo.mongo_client.MongoClient`
27-
option or the ``OTEL_PYTHON_INSTRUMENTATION_MONGODB_ENABLED`` environment
28-
variable. Install the ``opentelemetry-api`` package, or use the
25+
Each public API call produces an operation span, with a span for every
26+
command it sends nested underneath, and a transaction produces a
27+
``transaction`` span covering the operations it contains. Enable it with the
28+
``tracing`` :class:`~pymongo.mongo_client.MongoClient` option or the
29+
``OTEL_PYTHON_INSTRUMENTATION_MONGODB_ENABLED`` environment variable.
30+
Install the ``opentelemetry-api`` package, or use the
2931
``pymongo[opentelemetry]`` extra, to enable this feature.
30-
An operation span now covers a cursor's entire lifetime, so every
31-
``getMore`` nests under the ``find``/``aggregate``/``listIndexes``/etc.
32-
operation that created the cursor instead of starting a sibling span of its
33-
own; this also covers command cursors such as the client bulk write results
34-
cursor. ``killCursors`` and ``endSessions`` now get operation spans of their
35-
own as well, and background monitoring spans no longer attach to a stale
36-
parent from client startup. A single ``transaction`` span now covers all
37-
retries of one ``with_transaction()`` call or of a directly retried
38-
``commit_transaction()``. Operation spans also keep their ``db.namespace``,
39-
``db.collection.name``, and ``db.operation.summary`` attributes even when
40-
the operation fails before any command is sent, such as on a
41-
server-selection timeout.
4232
- Fixed a potential out-of-bounds read in the C extension when decoding an
4333
array of BSON documents. An embedded document whose declared length exceeds
4434
the bytes remaining in the array now raises

pymongo/asynchronous/mongo_client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -638,14 +638,10 @@ def __init__(
638638
.. seealso:: The MongoDB documentation on `connections <https://dochub.mongodb.org/core/connections>`_.
639639
640640
.. versionchanged:: 4.18
641-
Added the ``tracing`` keyword argument. The ``tracing`` option
642-
creates one span per public API call (nesting each call's command
643-
spans underneath, including a cursor's whole lifetime of
644-
``getMore`` commands, so a cursor's operation span stays open
645-
across all of its batches) and a ``"transaction"`` pseudo-span
646-
wrapping either ``start_transaction()`` through
647-
``commit_transaction()``/``abort_transaction()`` or all retries of
648-
one ``with_transaction()`` call.
641+
Added the ``tracing`` keyword argument. Each public API call
642+
produces an operation span, with a span for every command it sends
643+
nested underneath, and a transaction produces a ``"transaction"``
644+
span covering the operations it contains.
649645
650646
.. versionchanged:: 4.17
651647
Added the ``max_adaptive_retries`` and ``enable_overload_retargeting`` URI and keyword arguments.

pymongo/synchronous/mongo_client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -639,14 +639,10 @@ def __init__(
639639
.. seealso:: The MongoDB documentation on `connections <https://dochub.mongodb.org/core/connections>`_.
640640
641641
.. versionchanged:: 4.18
642-
Added the ``tracing`` keyword argument. The ``tracing`` option
643-
creates one span per public API call (nesting each call's command
644-
spans underneath, including a cursor's whole lifetime of
645-
``getMore`` commands, so a cursor's operation span stays open
646-
across all of its batches) and a ``"transaction"`` pseudo-span
647-
wrapping either ``start_transaction()`` through
648-
``commit_transaction()``/``abort_transaction()`` or all retries of
649-
one ``with_transaction()`` call.
642+
Added the ``tracing`` keyword argument. Each public API call
643+
produces an operation span, with a span for every command it sends
644+
nested underneath, and a transaction produces a ``"transaction"``
645+
span covering the operations it contains.
650646
651647
.. versionchanged:: 4.17
652648
Added the ``max_adaptive_retries`` and ``enable_overload_retargeting`` URI and keyword arguments.

0 commit comments

Comments
 (0)