-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: OpenTelemetry
-
None
Context
Split from PYTHON-5947, which covered operation and transaction spans together. That ticket now covers operation spans only; this one covers the ``"transaction"`` pseudo-span the OpenTelemetry driver specification requires around a transaction's operations.
Depends on the operation spans from PYTHON-5947, since the transaction span is passed as the explicit parent when an operation span starts.
Definition of done
- A ``"transaction"`` span covers start_transaction() through commit_transaction()/abort_transaction(), with the operations inside nested under it.
- A retried with_transaction() produces one span for the whole call rather than one per attempt.
- Committing or aborting a transaction that never started on the server closes its span.
- A transaction span parents only its own session's operations.
Pitfalls
- The span must be passed as an explicit parent rather than pushed as ambient context, or a concurrently running unrelated session's operations are captured by it.
- with_transaction() and the direct API can be active on the same session, so ownership of the span has to be tracked rather than assumed.
- Transaction spans only run on a replica set; standalone and sharded skip them.