summary refs log tree commit diff
path: root/synapse/config/metrics.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-02-12 16:01:41 +0000
committerErik Johnston <erik@matrix.org>2019-02-12 16:01:41 +0000
commit6a8f902edbb1b003ae4a5f1c78d9c09fa4e87dfc (patch)
tree4746683a4d319c48b90e56f3bab32be7ab9a39f6 /synapse/config/metrics.py
parentBasic sentry integration (diff)
downloadsynapse-6a8f902edbb1b003ae4a5f1c78d9c09fa4e87dfc.tar.xz
Raise an appropriate error message if sentry_sdk missing
Diffstat (limited to 'synapse/config/metrics.py')
-rw-r--r--synapse/config/metrics.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/synapse/config/metrics.py b/synapse/config/metrics.py

index f312010a9b..7bab8b0b2b 100644 --- a/synapse/config/metrics.py +++ b/synapse/config/metrics.py
@@ -13,7 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ._base import Config +from ._base import Config, ConfigError + +MISSING_SENTRY = ( + """Missing sentry_sdk library. This is required for enable sentry.io + integration. + + Install by running: + pip install sentry_sdk + """ +) class MetricsConfig(Config): @@ -25,6 +34,11 @@ class MetricsConfig(Config): self.sentry_enabled = "sentry" in config if self.sentry_enabled: + try: + import sentry_sdk # noqa F401 + except ImportError: + raise ConfigError(MISSING_SENTRY) + self.sentry_dsn = config["sentry"]["dsn"] def default_config(self, report_stats=None, **kwargs):