Skip to content

Commit 3b28649

Browse files
BYKszokeasaurusrex
andauthored
feat: Sample everything 100% w/ Spotlight & no DSN set (#4207)
This patch makes Spotlight easier to setup by turning all sampling to 100% when no DSN is set and Spotlight is enabled. I consider this a non-breaking and a safe change as these only apply when no DSN is set so it should have no production or billing implications. --------- Co-authored-by: Daniel Szoke <[email protected]>
1 parent 4aaadf4 commit 3b28649

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sentry_sdk/client.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,12 @@ def _capture_envelope(envelope):
417417

418418
if self.options.get("spotlight"):
419419
self.spotlight = setup_spotlight(self.options)
420+
if not self.options["dsn"]:
421+
sample_all = lambda *_args, **_kwargs: 1.0
422+
self.options["send_default_pii"] = True
423+
self.options["error_sampler"] = sample_all
424+
self.options["traces_sampler"] = sample_all
425+
self.options["profiles_sampler"] = sample_all
420426

421427
sdk_name = get_sdk_name(list(self.integrations.keys()))
422428
SDK_INFO["name"] = sdk_name
@@ -468,11 +474,7 @@ def should_send_default_pii(self):
468474
469475
Returns whether the client should send default PII (Personally Identifiable Information) data to Sentry.
470476
"""
471-
result = self.options.get("send_default_pii")
472-
if result is None:
473-
result = not self.options["dsn"] and self.spotlight is not None
474-
475-
return result
477+
return self.options.get("send_default_pii") or False
476478

477479
@property
478480
def dsn(self):

0 commit comments

Comments
 (0)