mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 16:43:57 +00:00
sentry: Set environment to staging on staging hosts.
Splitting exceptions out between staging and production provides useful filtering.
This commit is contained in:
committed by
Tim Abbott
parent
16691110a6
commit
a985284b5d
@@ -11,7 +11,7 @@ from sentry_sdk.utils import capture_internal_exceptions
|
||||
|
||||
from version import ZULIP_VERSION
|
||||
|
||||
from .config import PRODUCTION
|
||||
from .config import PRODUCTION, STAGING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sentry_sdk._types import Event, Hint
|
||||
@@ -60,9 +60,16 @@ def add_context(event: "Event", hint: "Hint") -> Optional["Event"]:
|
||||
def setup_sentry(dsn: Optional[str], *integrations: Integration) -> None:
|
||||
if not dsn:
|
||||
return
|
||||
if PRODUCTION:
|
||||
if STAGING:
|
||||
environment = "staging"
|
||||
else:
|
||||
environment = "production"
|
||||
else:
|
||||
environment = "development"
|
||||
sentry_sdk.init(
|
||||
dsn=dsn,
|
||||
environment="production" if PRODUCTION else "development",
|
||||
environment=environment,
|
||||
release=ZULIP_VERSION,
|
||||
integrations=[
|
||||
DjangoIntegration(),
|
||||
|
||||
Reference in New Issue
Block a user