diff --git a/changelog.d/16738.doc b/changelog.d/16738.doc new file mode 100644 index 000000000000..311acf520a62 --- /dev/null +++ b/changelog.d/16738.doc @@ -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. \ No newline at end of file diff --git a/changelog.d/16738.feature b/changelog.d/16738.feature new file mode 100644 index 000000000000..6b4ed3e80892 --- /dev/null +++ b/changelog.d/16738.feature @@ -0,0 +1 @@ +Enhanced Sentry configuration with a startup-loaded environment for improved system monitoring. Contributed by @zeeshanrafiqrana. \ No newline at end of file diff --git a/docs/usage/configuration/config_documentation.md b/docs/usage/configuration/config_documentation.md index dc92cc2992a3..ac4f8e89f75e 100644 --- a/docs/usage/configuration/config_documentation.md +++ b/docs/usage/configuration/config_documentation.md @@ -2772,7 +2772,7 @@ 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 and specify the environment in the `environment` field. 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 @@ -2783,6 +2783,7 @@ through insecure notification channels if so configured. Example configuration: ```yaml sentry: + environment: "production" dsn: "..." ``` --- diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 9a52dab67e65..aed98f03af30 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -662,14 +662,10 @@ def setup_sentry(hs: "HomeServer") -> None: import sentry_sdk - # Set a default environment if it's not configured - default_environment = None - environment = hs.config.metrics.sentry_environment or default_environment - sentry_sdk.init( dsn=hs.config.metrics.sentry_dsn, release=SYNAPSE_VERSION, - environment=environment, + environment=hs.config.metrics.sentry_environment, ) # We set some default tags that give some context to this instance