Skip to content

Commit bc620c4

Browse files
feat(py-client)!: Remove deprecated propagate_traces argument from Client (#714)
`Client(propagate_traces=...)` was deprecated previously, because Sentry's `StdlibIntegration` already propagates traces on the underlying HTTP request. This removes the argument, its `DeprecationWarning`, the internal plumbing through `Session`, the header injection in `_make_headers`, the now-unused `sentry_sdk` import in `client.py`, and the README mention. Spans emitted by the client (`tracing.py`) aren't affected. Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
1 parent fbb280d commit bc620c4

2 files changed

Lines changed: 0 additions & 26 deletions

File tree

‎clients/python/README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ from objectstore_client import Client, Usecase
220220

221221
client = Client(
222222
"http://localhost:8888",
223-
propagate_traces=False, # default
224223
retries=3, # default: 3 connect retries, no read retries
225224
timeout_ms=None, # default: no read timeout (connect: 100ms)
226225
connection_kwargs={}, # default: empty (override urllib3.HTTPConnectionPool kwargs)

‎clients/python/src/objectstore_client/client.py‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from typing import IO, Any, Literal, NamedTuple, cast
1313
from urllib.parse import urlparse
1414

15-
import sentry_sdk
1615
import urllib3
1716
import zstandard
1817
from urllib3.connectionpool import HTTPConnectionPool
@@ -150,13 +149,6 @@ class Client:
150149
"http://objectstore:8888"). metrics_backend: Optional metrics backend for
151150
tracking storage operations. Defaults to ``NoOpMetricsBackend`` if not
152151
provided.
153-
propagate_traces: **Deprecated.** Use Sentry's ``StdlibIntegration``
154-
instead; it propagates traces on the underlying HTTP request
155-
regardless of this flag, unless the host application's Sentry SDK
156-
is configured to opt out.
157-
158-
This only controls headers this client adds itself. Defaults to
159-
``False``.
160152
retries: Number of connection retries for failed requests.
161153
Defaults to ``3`` if not specified. **Note:** only connection failures are
162154
retried, not read failures (as compression streams cannot be rewound).
@@ -193,21 +185,12 @@ def __init__(
193185
self,
194186
base_url: str,
195187
metrics_backend: MetricsBackend | None = None,
196-
propagate_traces: bool = False,
197188
retries: int | None = None,
198189
timeout_ms: float | None = None,
199190
connection_kwargs: Mapping[str, Any] | None = None,
200191
token: TokenProvider | None = None,
201192
spool_dir: str | PathLike[str] | None = None,
202193
):
203-
if propagate_traces:
204-
warnings.warn(
205-
"`propagate_traces` is deprecated; Sentry's `StdlibIntegration` "
206-
"already propagates traces on the underlying HTTP request",
207-
DeprecationWarning,
208-
stacklevel=2,
209-
)
210-
211194
connection_kwargs_to_use = asdict(_ConnectionDefaults())
212195

213196
if retries is not None:
@@ -235,7 +218,6 @@ def __init__(
235218
)
236219
self._base_path = urlparse(base_url).path
237220
self._metrics_backend = metrics_backend or NoOpMetricsBackend()
238-
self._propagate_traces = propagate_traces
239221
self._token = token
240222
self._spool_dir = spool_dir
241223

@@ -269,7 +251,6 @@ def session(self, usecase: Usecase, **scopes: str | int | bool) -> Session:
269251
self._pool,
270252
self._base_path,
271253
self._metrics_backend,
272-
self._propagate_traces,
273254
usecase,
274255
Scope(**scopes),
275256
self._token,
@@ -289,7 +270,6 @@ def __init__(
289270
pool: HTTPConnectionPool,
290271
base_path: str,
291272
metrics_backend: MetricsBackend,
292-
propagate_traces: bool,
293273
usecase: Usecase,
294274
scope: Scope,
295275
token: TokenProvider | None = None,
@@ -298,7 +278,6 @@ def __init__(
298278
self._pool = pool
299279
self._base_path = base_path
300280
self._metrics_backend = metrics_backend
301-
self._propagate_traces = propagate_traces
302281
self._usecase = usecase
303282
self._scope = scope
304283
self._token = token
@@ -358,10 +337,6 @@ def _auth_token(self) -> str | None:
358337

359338
def _make_headers(self) -> dict[str, str]:
360339
headers = dict(self._pool.headers)
361-
if self._propagate_traces:
362-
headers.update(
363-
dict(sentry_sdk.get_current_scope().iter_trace_propagation_headers())
364-
)
365340
if token := self._auth_token():
366341
headers["x-os-auth"] = f"Bearer {token}"
367342
return headers

0 commit comments

Comments
 (0)