Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Spotlight back through devservices #87295

Merged
merged 5 commits into from
Mar 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions devservices/config.yml
Original file line number Diff line number Diff line change
@@ -60,17 +60,19 @@ x-sentry-service-config:
description: Messaging and streaming broker
memcached:
description: Memcached used for caching
spotlight:
description: Spotlight server for local debugging

modes:
default: [snuba, postgres, relay]
default: [snuba, postgres, relay, spotlight]
migrations: [postgres, redis]
acceptance-ci: [postgres, snuba, chartcuterie]
taskbroker: [snuba, postgres, relay, taskbroker]
taskbroker: [snuba, postgres, relay, taskbroker, spotlight]
backend-ci: [snuba, postgres, redis, bigtable, redis-cluster, symbolicator]
rabbitmq: [postgres, snuba, rabbitmq]
symbolicator: [postgres, snuba, symbolicator]
memcached: [postgres, snuba, memcached]
profiling: [postgres, snuba, vroom]
rabbitmq: [postgres, snuba, rabbitmq, spotlight]
symbolicator: [postgres, snuba, symbolicator, spotlight]
memcached: [postgres, snuba, memcached, spotlight]
profiling: [postgres, snuba, vroom, spotlight]
minimal: [postgres, snuba]
full:
[
@@ -83,6 +85,7 @@ x-sentry-service-config:
taskbroker,
rabbitmq,
vroom,
spotlight,
]

services:
@@ -159,6 +162,15 @@ services:
- devservices
extra_hosts:
- host.docker.internal:host-gateway
spotlight:
image: ghcr.io/getsentry/spotlight:latest
restart: unless-stopped
ports:
- '127.0.0.1:8969:8969/tcp'
networks:
- devservices
labels:
- orchestrator=devservices

networks:
devservices:
4 changes: 3 additions & 1 deletion src/sentry/conf/server.py
Original file line number Diff line number Diff line change
@@ -97,6 +97,8 @@ def env(
ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", "production")

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

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

# To have finer control over which process will have continuous profiling enabled,
# this environment variable will be required to enable continuous profiling.
1 change: 1 addition & 0 deletions src/sentry/conf/types/sdk_config.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ class SdkConfig(TypedDict):
send_default_pii: bool
auto_enabling_integrations: bool
keep_alive: NotRequired[bool]
spotlight: NotRequired[str | bool | None]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can remove None from here now?

Suggested change
spotlight: NotRequired[str | bool | None]
spotlight: NotRequired[str | bool]


send_client_reports: NotRequired[bool]
traces_sampler: NotRequired[Callable[[dict[str, Any]], float]]
4 changes: 4 additions & 0 deletions src/sentry/utils/sdk.py
Original file line number Diff line number Diff line change
@@ -303,6 +303,10 @@ def configure_sdk():
Setup and initialize the Sentry SDK.
"""
sdk_options, dsns = _get_sdk_options()
if settings.SPOTLIGHT:
sdk_options["spotlight"] = (
settings.SPOTLIGHT_ENV_VAR if settings.SPOTLIGHT_ENV_VAR.startswith("http") else True
)

internal_project_key = get_project_key()