Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Sentry Alert configuration based on production and development environment #16738

Merged
5 changes: 5 additions & 0 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,14 @@ def setup_sentry(hs: "HomeServer") -> None:

import sentry_sdk

# Set a default environment if it's not configured
default_environment = ""
environment = hs.config.metrics.sentry_environment or default_environment
zeeshanrafiqrana marked this conversation as resolved.
Show resolved Hide resolved

sentry_sdk.init(
dsn=hs.config.metrics.sentry_dsn,
release=SYNAPSE_VERSION,
environment=environment,
)

# We set some default tags that give some context to this instance
Expand Down
1 change: 1 addition & 0 deletions synapse/config/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
check_requirements("sentry")

self.sentry_dsn = config["sentry"].get("dsn")
self.sentry_environment = config["sentry"].get("environment")
if not self.sentry_dsn:
raise ConfigError(
"sentry.dsn field is required when sentry integration is enabled"
Expand Down