Commit 6638ae1
committed
PYTHON-5947 Add OpenTelemetry operation spans
Give every public API call an operation span containing one command span
per command sent to the server, per the OpenTelemetry driver specification.
The span covers all retry attempts of one _retry_internal call, so retries
appear as sibling command spans rather than being collapsed into one.
killCursors and endSessions bypass the retry layer and start their spans at
the call site instead, as does an unacknowledged client bulk write, which
never reaches the command-span code that would fill in its namespace.
Cursor-creating operations (find, aggregate, listCollections, listIndexes)
are covered here, but only for the command that creates the cursor. Spans
for caller-driven getMores come in a later change, as do transaction spans.
_otel.py also takes over the specification's naming and attribute rules, so
_telemetry.py deals only with span lifecycles and a specification change
need not touch it. Namespace parsing moves to helpers_shared._split_namespace.1 parent a5d3f6d commit 6638ae1
32 files changed
Lines changed: 2151 additions & 336 deletions
File tree
- .evergreen
- generated_configs
- scripts
- bson
- doc
- pymongo
- asynchronous
- synchronous
- test
- asynchronous
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
449 | 452 | | |
450 | 453 | | |
451 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
462 | 478 | | |
463 | 479 | | |
464 | 480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | 1118 | | |
1122 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
1123 | 1122 | | |
1124 | 1123 | | |
1125 | 1124 | | |
1126 | 1125 | | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | 1126 | | |
1131 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
1132 | 1130 | | |
1133 | 1131 | | |
1134 | 1132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
0 commit comments