diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 7841c4d9b4..c5fa461c15 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -160,7 +160,7 @@ class SPANDATA: AI_TOOL_CALLS = "ai.tool_calls" """ - For an AI model call, the function that was called. This is deprecated for OpenAI, and replaced by tool_calls + For an AI model call, the function that was called. """ AI_TOOLS = "ai.tools" diff --git a/sentry_sdk/integrations/opentelemetry/scope.py b/sentry_sdk/integrations/opentelemetry/scope.py index c04c299e38..56dd129a7f 100644 --- a/sentry_sdk/integrations/opentelemetry/scope.py +++ b/sentry_sdk/integrations/opentelemetry/scope.py @@ -1,5 +1,6 @@ from typing import cast from contextlib import contextmanager +import warnings from opentelemetry.context import ( get_value, @@ -142,8 +143,10 @@ def start_transaction(self, **kwargs): This function is deprecated and will be removed in a future release. Use :py:meth:`sentry_sdk.start_span` instead. """ - logger.warning( - "The `start_transaction` method is deprecated, please use `sentry_sdk.start_span instead.`" + warnings.warn( + "The `start_transaction` method is deprecated, please use `sentry_sdk.start_span instead.`", + DeprecationWarning, + stacklevel=2, ) return self.start_span(**kwargs) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 51f95cdeae..1784b6c5b3 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -563,8 +563,10 @@ def trace_propagation_meta(self, *args, **kwargs): """ span = kwargs.pop("span", None) if span is not None: - logger.warning( - "The parameter `span` in trace_propagation_meta() is deprecated and will be removed in the future." + warnings.warn( + "The parameter `span` in trace_propagation_meta() is deprecated and will be removed in the future.", + DeprecationWarning, + stacklevel=2, ) meta = "" @@ -735,8 +737,10 @@ def transaction(self, value): # transaction name or transaction (self._span) depending on the type of # the value argument. - logger.warning( - "Assigning to scope.transaction directly is deprecated: use scope.set_transaction_name() instead." + warnings.warn( + "Assigning to scope.transaction directly is deprecated: use scope.set_transaction_name() instead.", + DeprecationWarning, + stacklevel=2, ) self._transaction = value if self._span and self._span.containing_transaction: @@ -954,8 +958,10 @@ def start_transaction(self, **kwargs): This function is deprecated and will be removed in a future release. Use :py:meth:`sentry_sdk.start_span` instead. """ - logger.warning( - "The `start_transaction` method is deprecated, please use `sentry_sdk.start_span instead.`" + warnings.warn( + "The `start_transaction` method is deprecated, please use `sentry_sdk.start_span instead.`", + DeprecationWarning, + stacklevel=2, ) return NoOpSpan(**kwargs) diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 359014d961..0e31ad4ff5 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -1,6 +1,7 @@ from datetime import datetime from enum import Enum import json +import warnings from opentelemetry import trace as otel_trace, context from opentelemetry.trace import ( @@ -476,8 +477,10 @@ def containing_transaction(self): .. deprecated:: 3.0.0 This will be removed in the future. Use :func:`root_span` instead. """ - logger.warning( - "Deprecated: This will be removed in the future. Use root_span instead." + warnings.warn( + "Deprecated: This will be removed in the future. Use root_span instead.", + DeprecationWarning, + stacklevel=2, ) return self.root_span