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
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/16738.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify that in the Sentry configuration, adding the sentry.environment setting alongside the existing sentry.dsn setting enables log maintenance based on different environments, enhancing organizational control and analysis.
1 change: 1 addition & 0 deletions changelog.d/16738.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enhanced Sentry configuration with a startup-loaded environment for improved system monitoring. Contributed by @zeeshanrafiqrana.
erikjohnston marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 6 additions & 1 deletion docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2772,7 +2772,11 @@ enable_metrics: true
### `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
any sensitive information, this cannot be guaranteed. By enabling
Expand All @@ -2783,6 +2787,7 @@ through insecure notification channels if so configured.
Example configuration:
```yaml
sentry:
environment: "production"
dsn: "..."
```
---
Expand Down
1 change: 1 addition & 0 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ def setup_sentry(hs: "HomeServer") -> None:
sentry_sdk.init(
dsn=hs.config.metrics.sentry_dsn,
release=SYNAPSE_VERSION,
environment=hs.config.metrics.sentry_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
Loading