Skip to content

Commit 8b41c2a

Browse files
committed
Added deprecation warning
1 parent 3b34257 commit 8b41c2a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sentry_sdk/scope.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def transaction(self, value):
167167
"""When set this forces a specific transaction name to be set.
168168
169169
Deprecated: use set_transaction_name instead."""
170+
170171
# XXX: the docstring above is misleading. The implementation of
171172
# apply_to_event prefers an existing value of event.transaction over
172173
# anything set in the scope.
@@ -176,6 +177,10 @@ def transaction(self, value):
176177
# Without breaking version compatibility, we could make the setter set a
177178
# transaction name or transaction (self._span) depending on the type of
178179
# the value argument.
180+
181+
logger.warning(
182+
"Assigning to scope.transaction directly is deprecated: use scope.set_transaction_name() instead."
183+
)
179184
self._transaction = value
180185
if self._span and self._span.containing_transaction:
181186
self._span.containing_transaction.name = value

0 commit comments

Comments
 (0)