Skip to content

Commit 3ac05b4

Browse files
committed
Deprecated old transaction setter
1 parent 9cfe349 commit 3ac05b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sentry_sdk/scope.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ def transaction(self):
164164
def transaction(self, value):
165165
# type: (Any) -> None
166166
# would be type: (Optional[str]) -> None, see https://github.com/python/mypy/issues/3004
167-
"""When set this forces a specific transaction name to be set."""
167+
"""When set this forces a specific transaction name to be set.
168+
169+
Deprecated: use set_transaction_name instead."""
170+
168171
# XXX: the docstring above is misleading. The implementation of
169172
# apply_to_event prefers an existing value of event.transaction over
170173
# anything set in the scope.
@@ -174,6 +177,10 @@ def transaction(self, value):
174177
# Without breaking version compatibility, we could make the setter set a
175178
# transaction name or transaction (self._span) depending on the type of
176179
# the value argument.
180+
181+
logger.warning(
182+
"Assigning to scope.transaction directly is deprecated: use scope.set_transaction_name() instead."
183+
)
177184
self._transaction = value
178185
if self._span and self._span.containing_transaction:
179186
self._span.containing_transaction.name = value

0 commit comments

Comments
 (0)