Open yasinishyn opened 1 year ago
@yasinishyn I think your solution is reasonable, although I wonder if it would make more sense to add an extra_config
into the homserver config file which then just gets passed to sentry_sdk.init(...)
?
Something like:
sentry:
dsn: ...
extra_config:
environment: ...
debug: true
Then update the config code to pull that out and initialize the SDK:
sentry_sdk.init(
dsn=hs.config.metrics.sentry_dsn,
release=SYNAPSE_VERSION,
**hs.config.metrics.sentry_extra_config,
)
This would avoid Synapse needing to add / track the upstream Sentry features.
Currently, it's not possible to define Sentry environments. The initialization code is https://github.com/matrix-org/synapse/blob/9af2be192a759c22d189b72cc0a7580cd9de8a37/synapse/app/_base.py#L620
The SDK used supports environments definition as documented here https://docs.sentry.io/platforms/python/configuration/environments/
If configured, the environment is set to
production
by default. It's not ideal for teams who maintain several environments for the synapse backend (e.g. production, staging, development, etc...)An easy fix might be to:
Add
environment
to the homeserver.yaml filechange
synapse/config/metrics.py
here https://github.com/matrix-org/synapse/blob/9af2be192a759c22d189b72cc0a7580cd9de8a37/synapse/config/metrics.py#L59