Skip to content

Commit 7a9bb9d

Browse files
BYKgetsantry[bot]
andauthored
feat: Add Spotlight back through devservices (#87295)
Adds and enables Spotlight by default which will now show up at the bottom right corner with all transactions etc. This also enables profiling as they would show up in Spotlight. I'll be following up enabling Spotlight for Snuba to get a more complete picture after this. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 603ee01 commit 7a9bb9d

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

devservices/config.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,19 @@ x-sentry-service-config:
6060
description: Messaging and streaming broker
6161
memcached:
6262
description: Memcached used for caching
63+
spotlight:
64+
description: Spotlight server for local debugging
6365

6466
modes:
65-
default: [snuba, postgres, relay]
67+
default: [snuba, postgres, relay, spotlight]
6668
migrations: [postgres, redis]
6769
acceptance-ci: [postgres, snuba, chartcuterie]
68-
taskbroker: [snuba, postgres, relay, taskbroker]
70+
taskbroker: [snuba, postgres, relay, taskbroker, spotlight]
6971
backend-ci: [snuba, postgres, redis, bigtable, redis-cluster, symbolicator]
70-
rabbitmq: [postgres, snuba, rabbitmq]
71-
symbolicator: [postgres, snuba, symbolicator]
72-
memcached: [postgres, snuba, memcached]
73-
profiling: [postgres, snuba, vroom]
72+
rabbitmq: [postgres, snuba, rabbitmq, spotlight]
73+
symbolicator: [postgres, snuba, symbolicator, spotlight]
74+
memcached: [postgres, snuba, memcached, spotlight]
75+
profiling: [postgres, snuba, vroom, spotlight]
7476
minimal: [postgres, snuba]
7577
full:
7678
[
@@ -83,6 +85,7 @@ x-sentry-service-config:
8385
taskbroker,
8486
rabbitmq,
8587
vroom,
88+
spotlight,
8689
]
8790

8891
services:
@@ -159,6 +162,15 @@ services:
159162
- devservices
160163
extra_hosts:
161164
- host.docker.internal:host-gateway
165+
spotlight:
166+
image: ghcr.io/getsentry/spotlight:latest
167+
restart: unless-stopped
168+
ports:
169+
- '127.0.0.1:8969:8969/tcp'
170+
networks:
171+
- devservices
172+
labels:
173+
- orchestrator=devservices
162174

163175
networks:
164176
devservices:

src/sentry/conf/server.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def env(
9797
ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", "production")
9898

9999
IS_DEV = ENVIRONMENT == "development"
100+
SPOTLIGHT_ENV_VAR = os.environ.get("SENTRY_SPOTLIGHT", "")
101+
SPOTLIGHT = IS_DEV and SPOTLIGHT_ENV_VAR.lower() not in ("0", "false", "n", "no")
100102

101103
DEBUG = IS_DEV
102104
# override the settings dumped in the debug view
@@ -2641,7 +2643,7 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
26412643
#
26422644
# This will allow us to have finer control over where we are running the
26432645
# profiler. For example, only on the web server.
2644-
SENTRY_PROFILING_ENABLED = os.environ.get("SENTRY_PROFILING_ENABLED", False)
2646+
SENTRY_PROFILING_ENABLED = os.environ.get("SENTRY_PROFILING_ENABLED", SPOTLIGHT)
26452647

26462648
# To have finer control over which process will have continuous profiling enabled,
26472649
# this environment variable will be required to enable continuous profiling.

src/sentry/conf/types/sdk_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class SdkConfig(TypedDict):
1515
send_default_pii: bool
1616
auto_enabling_integrations: bool
1717
keep_alive: NotRequired[bool]
18+
spotlight: NotRequired[str | bool | None]
1819

1920
send_client_reports: NotRequired[bool]
2021
traces_sampler: NotRequired[Callable[[dict[str, Any]], float]]

src/sentry/utils/sdk.py

+4
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ def configure_sdk():
303303
Setup and initialize the Sentry SDK.
304304
"""
305305
sdk_options, dsns = _get_sdk_options()
306+
if settings.SPOTLIGHT:
307+
sdk_options["spotlight"] = (
308+
settings.SPOTLIGHT_ENV_VAR if settings.SPOTLIGHT_ENV_VAR.startswith("http") else True
309+
)
306310

307311
internal_project_key = get_project_key()
308312

0 commit comments

Comments
 (0)