Skip to content

Commit 24790eb

Browse files
authored
ref(spotlight): Do not import sentry_sdk.spotlight unless enabled (#4607)
Closes #4605
1 parent 0e73049 commit 24790eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sentry_sdk/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
)
4848
from sentry_sdk.scrubber import EventScrubber
4949
from sentry_sdk.monitor import Monitor
50-
from sentry_sdk.spotlight import setup_spotlight
5150

5251
if TYPE_CHECKING:
5352
from typing import Any
@@ -429,6 +428,10 @@ def _capture_envelope(envelope):
429428
)
430429

431430
if self.options.get("spotlight"):
431+
# This is intentionally here to prevent setting up spotlight
432+
# stuff we don't need unless spotlight is explicitly enabled
433+
from sentry_sdk.spotlight import setup_spotlight
434+
432435
self.spotlight = setup_spotlight(self.options)
433436
if not self.options["dsn"]:
434437
sample_all = lambda *_args, **_kwargs: 1.0

0 commit comments

Comments
 (0)