Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,18 @@ buildvariants:
- windows-2022-latest-small
batchtime: 1440

# Otel tests
- name: otel-rhel8
tasks:
- name: .test-non-standard .standalone-noauth-nossl
display_name: OTel RHEL8
run_on:
- rhel8.10-small
expansions:
TEST_NAME: otel
COVERAGE: "1"
tags: [pr]

# Perf tests
- name: performance-benchmarks
tasks:
Expand Down
15 changes: 15 additions & 0 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,21 @@ def create_doctests_variants():
]


def create_otel_variants():
host = DEFAULT_HOST
# Merge otel's coverage into the combined report; see setup_tests.py's COVERAGE handling.
expansions = dict(TEST_NAME="otel", COVERAGE="1")
return [
create_variant(
[".test-non-standard .standalone-noauth-nossl"],
get_variant_name("OTel", host),
host=host,
tags=["pr"],
expansions=expansions,
)
]


def create_atlas_connect_variants():
host = DEFAULT_HOST
return [
Expand Down
16 changes: 14 additions & 2 deletions .evergreen/scripts/setup_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"enterprise_auth": "gssapi",
"kms": "encryption",
"ocsp": "ocsp",
"otel": "opentelemetry",
"pyopenssl": "ocsp",
}

Expand Down Expand Up @@ -502,6 +503,16 @@ def handle_test_env() -> None:
if test_name == "numpy":
UV_ARGS.append("--with numpy")

if test_name == "otel":
# The SDK is test-only tooling (for the in-memory span exporter); the driver
# itself must not depend on it, only on opentelemetry-api (the "opentelemetry" extra).
# The lower bound matters: under --resolution=lowest-direct an unpinned
# --with dependency resolves to its oldest version (1.0.0), which pins
# opentelemetry-api==1.0.0 and drags the API below the driver's floor
# (>=1.20.0 in requirements/opentelemetry.txt). Keep the SDK's floor in
# sync with that file when bumping the supported API version.
UV_ARGS.append("--with opentelemetry-sdk>=1.20.0")

if test_name == "perf":
data_dir = ROOT / "specifications/source/benchmarking/data"
if not data_dir.exists():
Expand All @@ -527,9 +538,10 @@ def handle_test_env() -> None:
else:
TEST_ARGS = f"test/performance/async_perf_test.py {TEST_ARGS}"

# Add coverage if requested.
# Add coverage if requested, either via --cov or a pre-set COVERAGE expansion
# (e.g. a buildvariant that wants its coverage merged into the combined report).
# Only cover CPython. PyPy reports suspiciously low coverage.
if opts.cov and platform.python_implementation() == "CPython":
if (opts.cov or is_set("COVERAGE")) and platform.python_implementation() == "CPython":
# Keep in sync with combine-coverage.sh.
# coverage >=5 is needed for relative_files=true.
UV_ARGS.append("--group coverage")
Expand Down
1 change: 1 addition & 0 deletions .evergreen/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Distro:
"load_balancer": "load_balancer",
"mockupdb": "mockupdb",
"ocsp": "ocsp",
"otel": "otel",
"perf": "perf",
"sfp": "sfp",
"numpy": "",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ expansion.yml
.evergreen/scripts/test-env.sh
specifications/
results.json
otel-bench-results/
.synchro-modified
.evergreen/atlas_x509_dev_client_certificate.pem
.evergreen/atlas_x509_sfp_client_certificate.pem
Expand Down
6 changes: 6 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ PyMongo 4.18 brings a number of changes including:
:meth:`~pymongo.synchronous.database.Database.aggregate`, and
:meth:`~pymongo.asynchronous.collection.AsyncCollection.list_search_indexes`
and :meth:`~pymongo.synchronous.collection.Collection.list_search_indexes`.
- Added optional OpenTelemetry command-span support, conforming to the
`OpenTelemetry driver specification <https://github.com/mongodb/specifications/blob/master/source/open-telemetry/open-telemetry.md>`_.
Enable it with the ``tracing`` :class:`~pymongo.mongo_client.MongoClient`
option or the ``OTEL_PYTHON_INSTRUMENTATION_MONGODB_ENABLED`` environment
variable. Install the ``opentelemetry-api`` package, or use the
``pymongo[opentelemetry]`` extra, to enable this feature.

Changes in Version 4.17.0 (2026/04/20)
--------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set shell := ["bash", "-c"]

# Commonly used command segments.
typing_run := "uv run --group typing --extra aws --extra encryption --with numpy --extra ocsp --extra snappy --extra test --extra zstd"
typing_run := "uv run --group typing --extra aws --extra encryption --with numpy --extra ocsp --extra opentelemetry --with opentelemetry-sdk --extra snappy --extra test --extra zstd"
docs_run := "uv run --extra docs"
doc_build := "./doc/_build"
mypy_args := "--install-types --non-interactive"
Expand Down
Loading
Loading