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

Commit e108cde

Browse files
Sentry Alert configuration based on production and development environment (#16738)
1 parent e108c31 commit e108cde

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

changelog.d/16738.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add new Sentry configuration option `environment` for improved system monitoring. Contributed by @zeeshanrafiqrana.

docs/usage/configuration/config_documentation.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,11 @@ enable_metrics: true
27772777
### `sentry`
27782778

27792779
Use this option to enable sentry integration. Provide the DSN assigned to you by sentry
2780-
with the `dsn` setting.
2780+
with the `dsn` setting.
2781+
2782+
An optional `environment` field can be used to specify an environment. This allows
2783+
for log maintenance based on different environments, ensuring better organization
2784+
and analysis..
27812785

27822786
NOTE: While attempts are made to ensure that the logs don't contain
27832787
any sensitive information, this cannot be guaranteed. By enabling
@@ -2788,6 +2792,7 @@ through insecure notification channels if so configured.
27882792
Example configuration:
27892793
```yaml
27902794
sentry:
2795+
environment: "production"
27912796
dsn: "..."
27922797
```
27932798
---

synapse/app/_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ def setup_sentry(hs: "HomeServer") -> None:
665665
sentry_sdk.init(
666666
dsn=hs.config.metrics.sentry_dsn,
667667
release=SYNAPSE_VERSION,
668+
environment=hs.config.metrics.sentry_environment,
668669
)
669670

670671
# We set some default tags that give some context to this instance

synapse/config/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
6161
check_requirements("sentry")
6262

6363
self.sentry_dsn = config["sentry"].get("dsn")
64+
self.sentry_environment = config["sentry"].get("environment")
6465
if not self.sentry_dsn:
6566
raise ConfigError(
6667
"sentry.dsn field is required when sentry integration is enabled"

0 commit comments

Comments
 (0)