Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
sentry: Set environment from `machine.deploy_type` config.
Alex Vandiver928dc4bafd8f
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.pyindex 02a650e584d..a4364907fcd 100644--- a/zproject/computed_settings.py+++ b/zproject/computed_settings.py@@ -1185,4 +1185,4 @@ SENTRY_DSN = os.environ.get("SENTRY_DSN", SENTRY_DSN)if SENTRY_DSN:from .sentry import setup_sentry- setup_sentry(SENTRY_DSN)+ setup_sentry(SENTRY_DSN, get_config("machine", "deploy_type", "development"))diff --git a/zproject/config.py b/zproject/config.pyindex ae7473b150d..42ec637b749 100644--- a/zproject/config.py+++ b/zproject/config.py@@ -9,7 +9,6 @@ config_file.read("/etc/zulip/zulip.conf")# Whether this instance of Zulip is running in a production environment.PRODUCTION = config_file.has_option("machine", "deploy_type")-STAGING = config_file.get("machine", "deploy_type", fallback="") == "staging"DEVELOPMENT = not PRODUCTIONsecrets_file = configparser.RawConfigParser()diff --git a/zproject/sentry.py b/zproject/sentry.pyindex 2658f108109..b45864c5316 100644--- a/zproject/sentry.py+++ b/zproject/sentry.py@@ -11,8 +11,6 @@ from sentry_sdk.utils import capture_internal_exceptionsfrom version import ZULIP_VERSIONfrom zerver.lib.request import get_request_notes-from .config import PRODUCTION, STAGING-if TYPE_CHECKING:from sentry_sdk._types import Event, Hint@@ -58,16 +56,9 @@ def add_context(event: "Event", hint: "Hint") -> Optional["Event"]:return event-def setup_sentry(dsn: Optional[str]) -> None:+def setup_sentry(dsn: Optional[str], environment: str) -> None:if not dsn:return- if PRODUCTION:- if STAGING:- environment = "staging"- else:- environment = "production"- else:- environment = "development"sentry_sdk.init(dsn=dsn,environment=environment,