Sentry Alert configuration based on production and development environment (#16738)
parent
e108c31fc0
commit
e108cde669
|
@ -0,0 +1 @@
|
||||||
|
Add new Sentry configuration option `environment` for improved system monitoring. Contributed by @zeeshanrafiqrana.
|
|
@ -2777,7 +2777,11 @@ enable_metrics: true
|
||||||
### `sentry`
|
### `sentry`
|
||||||
|
|
||||||
Use this option to enable sentry integration. Provide the DSN assigned to you by sentry
|
Use this option to enable sentry integration. Provide the DSN assigned to you by sentry
|
||||||
with the `dsn` setting.
|
with the `dsn` setting.
|
||||||
|
|
||||||
|
An optional `environment` field can be used to specify an environment. This allows
|
||||||
|
for log maintenance based on different environments, ensuring better organization
|
||||||
|
and analysis..
|
||||||
|
|
||||||
NOTE: While attempts are made to ensure that the logs don't contain
|
NOTE: While attempts are made to ensure that the logs don't contain
|
||||||
any sensitive information, this cannot be guaranteed. By enabling
|
any sensitive information, this cannot be guaranteed. By enabling
|
||||||
|
@ -2788,6 +2792,7 @@ through insecure notification channels if so configured.
|
||||||
Example configuration:
|
Example configuration:
|
||||||
```yaml
|
```yaml
|
||||||
sentry:
|
sentry:
|
||||||
|
environment: "production"
|
||||||
dsn: "..."
|
dsn: "..."
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
|
|
|
@ -665,6 +665,7 @@ def setup_sentry(hs: "HomeServer") -> None:
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
dsn=hs.config.metrics.sentry_dsn,
|
dsn=hs.config.metrics.sentry_dsn,
|
||||||
release=SYNAPSE_VERSION,
|
release=SYNAPSE_VERSION,
|
||||||
|
environment=hs.config.metrics.sentry_environment,
|
||||||
)
|
)
|
||||||
|
|
||||||
# We set some default tags that give some context to this instance
|
# We set some default tags that give some context to this instance
|
||||||
|
|
|
@ -61,6 +61,7 @@ class MetricsConfig(Config):
|
||||||
check_requirements("sentry")
|
check_requirements("sentry")
|
||||||
|
|
||||||
self.sentry_dsn = config["sentry"].get("dsn")
|
self.sentry_dsn = config["sentry"].get("dsn")
|
||||||
|
self.sentry_environment = config["sentry"].get("environment")
|
||||||
if not self.sentry_dsn:
|
if not self.sentry_dsn:
|
||||||
raise ConfigError(
|
raise ConfigError(
|
||||||
"sentry.dsn field is required when sentry integration is enabled"
|
"sentry.dsn field is required when sentry integration is enabled"
|
||||||
|
|
Loading…
Reference in New Issue