add environment based sentry sdk configuration
parent
aa983c7b0f
commit
89f6b3d69b
|
|
@ -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
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class MetricsConfig(Config):
|
|||
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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue