From c9c6ff19735752bf9310ece1f6776c3730542a69 Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Thu, 29 Oct 2026 16:19:48 +0300 Subject: [PATCH] Raise the OpenTelemetry floor to 1.42 / 0.63b0 and delete its shims --- .../0008-otel-sampling-is-a-sampler-object.md | 2 +- .../bootstrappers/fastmcp_bootstrapper.py | 4 +-- .../instruments/opentelemetry_instrument.py | 3 -- pyproject.toml | 36 +++++++++---------- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/docs/adr/0008-otel-sampling-is-a-sampler-object.md b/docs/adr/0008-otel-sampling-is-a-sampler-object.md index c468ae9..11f4ed8 100644 --- a/docs/adr/0008-otel-sampling-is-a-sampler-object.md +++ b/docs/adr/0008-otel-sampling-is-a-sampler-object.md @@ -4,7 +4,7 @@ default), the SDK picks its own sampler, which honours `OTEL_TRACES_SAMPLER` / `OTEL_TRACES_SAMPLER_ARG`, so both the default behaviour and the existing environment-variable path are unchanged; the pass-through needs no conditional, because `TracerProvider(sampler=None)` is identical to omitting -the argument at the declared 1.28 floor and at 1.44 alike. +the argument at the declared 1.42 floor and at 1.44 alike. A `float` sample rate mirroring `sentry_traces_sample_rate` was rejected. It buys no dependency independence, since `opentelemetry_instrumentors` already carries `BaseInstrumentor` and diff --git a/lite_bootstrap/bootstrappers/fastmcp_bootstrapper.py b/lite_bootstrap/bootstrappers/fastmcp_bootstrapper.py index 79047b5..e99f75c 100644 --- a/lite_bootstrap/bootstrappers/fastmcp_bootstrapper.py +++ b/lite_bootstrap/bootstrappers/fastmcp_bootstrapper.py @@ -35,7 +35,6 @@ from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware from opentelemetry.metrics import get_meter_provider from opentelemetry.trace import get_tracer_provider - from opentelemetry.util.http import parse_excluded_urls from starlette.routing import BaseRoute, Match, Mount, Route from starlette.types import Scope @@ -253,8 +252,7 @@ def _instrument_http_app(self, http_application: "StarletteWithLifespan") -> "St default_span_details=functools.partial( build_fastmcp_route_details_from_scope, routes=http_application.routes ), - # OpenTelemetryMiddleware only parses a raw string from 0.56b0; the floor is 0.49b0. - excluded_urls=parse_excluded_urls(",".join(self._build_excluded_url_patterns("STARLETTE"))), + excluded_urls=",".join(self._build_excluded_url_patterns("STARLETTE")), exclude_spans=self.bootstrap_config.opentelemetry_exclude_spans, tracer_provider=get_tracer_provider(), meter_provider=get_meter_provider(), diff --git a/lite_bootstrap/instruments/opentelemetry_instrument.py b/lite_bootstrap/instruments/opentelemetry_instrument.py index cd2fe8d..a275b61 100644 --- a/lite_bootstrap/instruments/opentelemetry_instrument.py +++ b/lite_bootstrap/instruments/opentelemetry_instrument.py @@ -151,9 +151,6 @@ def on_end(self, span: "ReadableSpan") -> None: pyroscope.remove_thread_tag(_PYROSCOPE_SPAN_ID_KEY, format_span_id(span.context.span_id)) pyroscope.remove_thread_tag(_PYROSCOPE_SPAN_NAME_KEY, span.name) - def force_flush(self, timeout_millis: int = 30000) -> bool: # noqa: ARG002 - return True # pragma: no cover - matters only at the sdk 1.28 floor, whose base returns None - OpenTelemetryConfigT = typing.TypeVar("OpenTelemetryConfigT", bound=OpenTelemetryConfig) diff --git a/pyproject.toml b/pyproject.toml index 39872fe..d0e2ea7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,21 +56,21 @@ pyroscope = [ "pyroscope-io>=1.0.1", ] otl = [ - # One release train: api/sdk/exporters 1.28 pair with every instrumentation package at - # 0.49b0. 0.49b0 is the first that does not import `pkg_resources`, which setuptools no - # longer ships, so anything older fails at import on a fresh install. The exporters carry - # the floor separately: nothing else constrains them, and left bare they resolve 23 minors - # behind the api they must match. - "opentelemetry-api>=1.28", - "opentelemetry-sdk>=1.28", - "opentelemetry-exporter-otlp-proto-grpc>=1.28", - "opentelemetry-instrumentation>=0.49b0", + # One release train: api/sdk/exporters 1.42 pair with every instrumentation package at + # 0.63b0. 1.42 is the first sdk whose base SpanProcessor.force_flush returns True rather + # than None, which PyroscopeSpanProcessor relies on. The exporters carry the floor + # separately: nothing else constrains them, so left bare they can resolve to a release + # that does not match the api. + "opentelemetry-api>=1.42", + "opentelemetry-sdk>=1.42", + "opentelemetry-exporter-otlp-proto-grpc>=1.42", + "opentelemetry-instrumentation>=0.63b0", ] otl-http = [ - "opentelemetry-api>=1.28", - "opentelemetry-sdk>=1.28", - "opentelemetry-exporter-otlp-proto-http>=1.28", - "opentelemetry-instrumentation>=0.49b0", + "opentelemetry-api>=1.42", + "opentelemetry-sdk>=1.42", + "opentelemetry-exporter-otlp-proto-http>=1.42", + "opentelemetry-instrumentation>=0.63b0", ] logging = [ # >=21.3 for structlog.stdlib.ProcessorFormatter.remove_processors_meta (LoggingInstrument's @@ -93,7 +93,7 @@ fastapi-sentry = [ ] fastapi-otl = [ "lite-bootstrap[fastapi,otl]", - "opentelemetry-instrumentation-fastapi>=0.49b0", + "opentelemetry-instrumentation-fastapi>=0.63b0", ] fastapi-logging = [ "lite-bootstrap[fastapi,logging]", @@ -129,9 +129,9 @@ litestar-otl = [ "lite-bootstrap[litestar,otl]", # >=2.22 for litestar.plugins.opentelemetry (LitestarOpenTelemetryInstrument registers its OpenTelemetryPlugin). "litestar>=2.22", - # Raised from 0.46b0 with the rest of the train: every instrumentation package pins - # `opentelemetry-instrumentation` to its own exact version, so they move together. - "opentelemetry-instrumentation-asgi>=0.49b0", + # Moves with the rest of the train: every instrumentation package pins + # `opentelemetry-instrumentation` to its own exact version. + "opentelemetry-instrumentation-asgi>=0.63b0", ] litestar-logging = [ "lite-bootstrap[litestar,logging]", @@ -183,7 +183,7 @@ fastmcp = [ ] fastmcp-otl = [ "lite-bootstrap[fastmcp,otl]", - "opentelemetry-instrumentation-asgi>=0.49b0", + "opentelemetry-instrumentation-asgi>=0.63b0", ] fastmcp-metrics = [ "lite-bootstrap[fastmcp]",