Skip to content

Commit c422241

Browse files
committed
backwards compat names
1 parent d0f766b commit c422241

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Performance Monitoring
4141
.. autofunction:: sentry_sdk.api.get_current_span
4242
.. autofunction:: sentry_sdk.api.start_span
4343
.. autofunction:: sentry_sdk.api.start_transaction
44+
.. autofunction:: sentry_sdk.api.update_current_span
4445

4546

4647
Distributed Tracing

sentry_sdk/api.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ def set_transaction_name(name, source=None):
476476
return get_current_scope().set_transaction_name(name, source)
477477

478478

479-
def update_current_span(op=None, name=None, attributes=None):
480-
# type: (Optional[str], Optional[str], Optional[dict[str, Union[str, int, float, bool]]]) -> None
479+
def update_current_span(op=None, name=None, attributes=None, data=None):
480+
# type: (Optional[str], Optional[str], Optional[dict[str, Union[str, int, float, bool]]], Optional[dict[str, Any]]) -> None
481481
"""
482482
Update the current active span with the provided parameters.
483483
@@ -496,6 +496,15 @@ def update_current_span(op=None, name=None, attributes=None):
496496
"SELECT * FROM users"). If not provided, the span's name will remain unchanged.
497497
:type name: str or None
498498
499+
:param data: A dictionary of key-value pairs to add as data to the span. This
500+
data will be merged with any existing span data. If not provided,
501+
no data will be added.
502+
503+
.. deprecated:: 2.35.0
504+
Use ``attributes`` instead. The ``data`` parameter will be removed
505+
in a future version.
506+
:type data: dict[str, Union[str, int, float, bool]] or None
507+
499508
:param attributes: A dictionary of key-value pairs to add as attributes to the span.
500509
Attribute values must be strings, integers, floats, or booleans. These
501510
attributes will be merged with any existing span data. If not provided,
@@ -504,7 +513,7 @@ def update_current_span(op=None, name=None, attributes=None):
504513
505514
:returns: None
506515
507-
.. versionadded:: 2.0.0
516+
.. versionadded:: 2.35.0
508517
509518
Example::
510519
@@ -529,5 +538,18 @@ def update_current_span(op=None, name=None, attributes=None):
529538
# internally it is still description
530539
current_span.description = name
531540

541+
if data is not None and attributes is not None:
542+
raise ValueError(
543+
"Cannot provide both `data` and `attributes`. Please use only `attributes`."
544+
)
545+
546+
if data is not None:
547+
warnings.warn(
548+
"The `data` parameter is deprecated. Please use `attributes` instead.",
549+
DeprecationWarning,
550+
stacklevel=2,
551+
)
552+
attributes = data
553+
532554
if attributes is not None:
533555
current_span.update_data(attributes)

0 commit comments

Comments
 (0)