Skip to content

Commit 9e48965

Browse files
authored
chore: Make start_span fail if unsupported args are provided (#4201)
Make the `Span` constructor actually fail if it gets unsupported arguments, as opposed to silently ignoring them, so that folks get notified early. Deprecating some of these in #4244 Closes #4200
1 parent 9977769 commit 9e48965

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

MIGRATION_GUIDE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
131131

132132
### Removed
133133

134-
- Spans no longer have a `description`. Use `name` instead.
135134
- Dropped support for Python 3.6.
136135
- The `enable_tracing` `init` option has been removed. Configure `traces_sample_rate` directly.
137136
- The `propagate_traces` `init` option has been removed. Use `trace_propagation_targets` instead.
@@ -157,11 +156,15 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
157156
- `profiles_sample_rate` and `profiler_mode` were removed from options available via `_experiments`. Use the top-level `profiles_sample_rate` and `profiler_mode` options instead.
158157
- `Transport.capture_event` has been removed. Use `Transport.capture_envelope` instead.
159158
- Function transports are no longer supported. Subclass the `Transport` instead.
159+
- `start_transaction` (`start_span`) no longer takes the following arguments:
160+
- `trace_id`, `baggage`: use `continue_trace` for propagation from headers or environment variables
161+
- `same_process_as_parent`
162+
- `span_id`
163+
- `parent_span_id`: you can supply a `parent_span` instead
160164
- Setting `Scope.transaction` directly is no longer supported. Use `Scope.set_transaction_name()` instead.
161165
- Passing a list or `None` for `failed_request_status_codes` in the Starlette integration is no longer supported. Pass a set of integers instead.
162166
- The `span` argument of `Scope.trace_propagation_meta` is no longer supported.
163167
- Setting `Scope.user` directly is no longer supported. Use `Scope.set_user()` instead.
164-
- `start_transaction` (`start_span`) no longer takes a `baggage` argument. Use the `continue_trace()` context manager instead to propagate baggage.
165168
- Dropped support for Django versions below 2.0.
166169
- Dropped support for trytond versions below 5.0.
167170
- Dropped support for Falcon versions below 3.0.

sentry_sdk/tracing.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,9 @@ def __init__(
239239
only_if_parent=False, # type: bool
240240
parent_span=None, # type: Optional[Span]
241241
otel_span=None, # type: Optional[OtelSpan]
242-
**_, # type: dict[str, object]
243242
):
244243
# type: (...) -> None
245244
"""
246-
For backwards compatibility with old the old Span interface, this class
247-
accepts arbitrary keyword arguments, in addition to the ones explicitly
248-
listed in the signature. These additional arguments are ignored.
249-
250245
If otel_span is passed explicitly, just acts as a proxy.
251246
252247
If only_if_parent is True, just return an INVALID_SPAN
@@ -284,6 +279,8 @@ def __init__(
284279
attributes[SentrySpanAttribute.OP] = op
285280
if source is not None:
286281
attributes[SentrySpanAttribute.SOURCE] = source
282+
if description is not None:
283+
attributes[SentrySpanAttribute.DESCRIPTION] = description
287284
if sampled is not None:
288285
attributes[SentrySpanAttribute.CUSTOM_SAMPLED] = sampled
289286

@@ -543,7 +540,7 @@ def timestamp(self):
543540

544541
def start_child(self, **kwargs):
545542
# type: (**Any) -> Span
546-
return Span(sampled=self.sampled, parent_span=self, **kwargs)
543+
return Span(parent_span=self, **kwargs)
547544

548545
def iter_headers(self):
549546
# type: () -> Iterator[Tuple[str, str]]

0 commit comments

Comments
 (0)