From b46a70424ea99b8c74e40c1922417e2660bf24c6 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 30 Jun 2026 14:20:53 +0200 Subject: [PATCH 1/2] Raise opentelemetry-sdk/exporter ceiling to <1.44.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit logfire pinned `opentelemetry-sdk<1.43.0`, which transitively blocked `opentelemetry-instrumentation-fastapi 0.64b0` — the release containing the fix for the FastAPI >=0.137 `_IncludedRouter` regression that 500s every CORS preflight (open-telemetry/opentelemetry-python-contrib#4700). Raise the upper bound on `opentelemetry-sdk` and `opentelemetry-exporter-otlp-proto-http` to `<1.44.0` so the 1.43.0 line (and fastapi-instrumentation 0.64b0) can be installed. Closes #2041 Co-Authored-By: Claude Opus 4.8 --- pyproject.toml | 4 ++-- uv.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7fb41ec16..48e699f65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,8 +46,8 @@ classifiers = [ "Framework :: OpenTelemetry :: Instrumentations", ] dependencies = [ - "opentelemetry-sdk >= 1.39.0, < 1.43.0", - "opentelemetry-exporter-otlp-proto-http >= 1.39.0, < 1.43.0", + "opentelemetry-sdk >= 1.39.0, < 1.44.0", + "opentelemetry-exporter-otlp-proto-http >= 1.39.0, < 1.44.0", "opentelemetry-instrumentation >= 0.41b0", "rich >= 13.4.2", "protobuf >= 4.23.4", diff --git a/uv.lock b/uv.lock index d566b34fe..20663e0ec 100644 --- a/uv.lock +++ b/uv.lock @@ -2458,7 +2458,7 @@ requires-dist = [ { name = "httpx", marker = "extra == 'gateway'", specifier = ">=0.27.0" }, { name = "openinference-instrumentation-dspy", marker = "extra == 'dspy'", specifier = ">=0" }, { name = "openinference-instrumentation-litellm", marker = "extra == 'litellm'", specifier = ">=0" }, - { name = "opentelemetry-exporter-otlp-proto-http", specifier = ">=1.39.0,<1.43.0" }, + { name = "opentelemetry-exporter-otlp-proto-http", specifier = ">=1.39.0,<1.44.0" }, { name = "opentelemetry-instrumentation", specifier = ">=0.41b0" }, { name = "opentelemetry-instrumentation-aiohttp-client", marker = "extra == 'aiohttp'", specifier = ">=0.42b0" }, { name = "opentelemetry-instrumentation-aiohttp-client", marker = "extra == 'aiohttp-client'", specifier = ">=0.42b0" }, @@ -2484,7 +2484,7 @@ requires-dist = [ { name = "opentelemetry-instrumentation-starlette", marker = "extra == 'starlette'", specifier = ">=0.42b0" }, { name = "opentelemetry-instrumentation-system-metrics", marker = "extra == 'system-metrics'", specifier = ">=0.42b0" }, { name = "opentelemetry-instrumentation-wsgi", marker = "extra == 'wsgi'", specifier = ">=0.42b0" }, - { name = "opentelemetry-sdk", specifier = ">=1.39.0,<1.43.0" }, + { name = "opentelemetry-sdk", specifier = ">=1.39.0,<1.44.0" }, { name = "packaging", marker = "extra == 'psycopg'" }, { name = "packaging", marker = "extra == 'psycopg2'" }, { name = "protobuf", specifier = ">=4.23.4" }, From 24019500fb04fd8580cd627c9fb221056e7ca2fd Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Wed, 1 Jul 2026 17:39:07 +0200 Subject: [PATCH 2/2] Keep tests deterministic across the OTel 1.42/1.43 boundary OpenTelemetry 1.43 changed the `service.instance.id` resource attribute from the 32-char `uuid4().hex` form to a dashed UUID4. The TestExporter normaliser only recognised the hex form, so on 1.43 a random UUID leaked into every resource snapshot. Match the dashed form too and normalise it to the same fixed value, keeping all existing snapshots valid on both versions. Also relax `test_max_body_size_bytes`: the exact serialised body size depends on the OTel version (897045 on 1.42, 897108 on 1.43), so assert the message shape via a regex rather than a hardcoded byte count. Verified the affected tests pass on both opentelemetry-sdk 1.42.1 and 1.43.0. Co-Authored-By: Claude Opus 4.8 --- logfire/_internal/exporters/test.py | 7 ++++++- tests/exporters/test_otlp_session.py | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/logfire/_internal/exporters/test.py b/logfire/_internal/exporters/test.py index 531164314..a3a9cfbca 100644 --- a/logfire/_internal/exporters/test.py +++ b/logfire/_internal/exporters/test.py @@ -150,7 +150,12 @@ def process_attribute( assert value == os.getpid() return 1234 if name == 'service.instance.id': - if re.match(r'^[0-9a-f]{32}$', value): + # OpenTelemetry <=1.42 set this to `uuid4().hex` (32 hex chars); 1.43+ uses the + # dashed UUID form. Normalise either representation to a fixed value so snapshots + # stay deterministic across OTel versions. + if re.match(r'^[0-9a-f]{32}$', value) or re.match( + r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', value + ): return '0' * 32 if parse_json_attributes and isinstance(value, str) and (value.startswith('{') or value.startswith('[')): try: diff --git a/tests/exporters/test_otlp_session.py b/tests/exporters/test_otlp_session.py index 7e2e9e25f..7521596d0 100644 --- a/tests/exporters/test_otlp_session.py +++ b/tests/exporters/test_otlp_session.py @@ -11,6 +11,7 @@ import pytest import requests import requests.exceptions +from dirty_equals import IsStr from inline_snapshot import snapshot from opentelemetry.sdk.trace.export import SpanExportResult from requests.models import PreparedRequest, Response as Response @@ -45,7 +46,9 @@ def test_max_body_size_bytes() -> None: exporter.max_body_size = 10 with pytest.raises(BodyTooLargeError) as e: exporter.export(TEST_SPANS) - assert str(e.value) == snapshot('Request body is too large (897045 bytes), must be less than 10 bytes.') + # The exact serialized size depends on the OpenTelemetry version, so match the message shape + # rather than a hardcoded byte count. + assert str(e.value) == IsStr(regex=r'Request body is too large \(\d+ bytes\), must be less than 10 bytes\.') def test_connection_error_retries(monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture) -> None: