Skip to content
Closed
2 changes: 1 addition & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def __init__(
debug=None, # type: Optional[bool]
attach_stacktrace=False, # type: bool
ca_certs=None, # type: Optional[str]
traces_sample_rate=None, # type: Optional[float]
traces_sample_rate=0, # type: Optional[float]
traces_sampler=None, # type: Optional[TracesSampler]
profiles_sample_rate=None, # type: Optional[float]
profiles_sampler=None, # type: Optional[TracesSampler]
Expand Down
6 changes: 6 additions & 0 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,12 @@ def set_tag(self, key, value):

def set_data(self, key, value):
# type: (str, Any) -> None
warnings.warn(
"`Span.set_data` is deprecated. Please use `Span.set_attribute` instead.",
DeprecationWarning,
stacklevel=2,
)

# TODO-neel-potel we cannot add dicts here
self.set_attribute(key, value)

Expand Down
5 changes: 4 additions & 1 deletion tests/integrations/aiohttp/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,10 @@ async def hello(request):
async def test_trace_from_headers_if_performance_disabled(
sentry_init, aiohttp_client, capture_events
):
sentry_init(integrations=[AioHttpIntegration()])
sentry_init(
traces_sample_rate=None, # disable all performance monitoring
integrations=[AioHttpIntegration()],
)

async def hello(request):
capture_message("It's a good day to try dividing by 0")
Expand Down
4 changes: 3 additions & 1 deletion tests/integrations/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ async def test_trace_from_headers_if_performance_disabled(
asgi3_app_with_error_and_msg,
capture_events,
):
sentry_init()
sentry_init(
traces_sample_rate=None, # disable all performance monitoring
)
app = SentryAsgiMiddleware(asgi3_app_with_error_and_msg)

trace_id = "582b43a4192642f0b136d5159a501701"
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/django/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ async def test_trace_from_headers_if_performance_enabled(sentry_init, capture_ev
)
async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_events):
sentry_init(
traces_sample_rate=None, # disable all performance monitoring
integrations=[DjangoIntegration()],
)

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/django/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def test_trace_from_headers_if_performance_disabled(
sentry_init, client, capture_events
):
sentry_init(
traces_sample_rate=None, # disable all performance monitoring
integrations=[
DjangoIntegration(
http_methods_to_capture=("HEAD",),
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/opentelemetry/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def keep_only_a(sampling_context):
@pytest.mark.parametrize(
"traces_sample_rate, expected_num_of_envelopes",
[
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=None will be used)
(-1, 0),
# special case for testing, do not pass any traces_sample_rate to init() (the default traces_sample_rate=0 will be used)
(-1, 1),
# traces_sample_rate=None means do not create new traces, and also do not continue incoming traces. So, no envelopes at all.
(None, 0),
# traces_sample_rate=0 means do not create new traces (0% of the requests), but continue incoming traces. So envelopes will be created only if there is an incoming trace.
Expand Down
4 changes: 3 additions & 1 deletion tests/integrations/wsgi/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def dogpark(environ, start_response):
capture_message("Attempting to fetch the ball")
raise ValueError("Fetch aborted. The ball was not returned.")

sentry_init()
sentry_init(
traces_sample_rate=None, # disable all performance monitoring
)
app = SentryWsgiMiddleware(dogpark)
client = Client(app)
events = capture_events()
Expand Down
Loading