aboutsummaryrefslogtreecommitdiff
path: root/setup/config
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2021-03-24 10:25:24 +0000
committerGitHub <noreply@github.com>2021-03-24 10:25:24 +0000
commitaf41f6d4549759afd7f52f780b40abe2834ab4c0 (patch)
treec13e5d27221981ac438e5880f5c93ae8999f596b /setup/config
parent802f1c96f804f7a146e4e12e25b20c980a6af870 (diff)
Add Sentry support (#1803)
* Add Sentry support * Use HTTP Sentry properly maybe * Capture panics * Log fed Sentry stuff correctly * British english linter
Diffstat (limited to 'setup/config')
-rw-r--r--setup/config/config_global.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/setup/config/config_global.go b/setup/config/config_global.go
index 4b5297ff..90a92f2b 100644
--- a/setup/config/config_global.go
+++ b/setup/config/config_global.go
@@ -49,6 +49,9 @@ type Global struct {
// Metrics configuration
Metrics Metrics `yaml:"metrics"`
+ // Sentry configuration
+ Sentry Sentry `yaml:"sentry"`
+
// DNS caching options for all outbound HTTP requests
DNSCache DNSCacheOptions `yaml:"dns_cache"`
}
@@ -63,6 +66,7 @@ func (c *Global) Defaults() {
c.Kafka.Defaults()
c.Metrics.Defaults()
c.DNSCache.Defaults()
+ c.Sentry.Defaults()
}
func (c *Global) Verify(configErrs *ConfigErrors, isMonolith bool) {
@@ -71,6 +75,7 @@ func (c *Global) Verify(configErrs *ConfigErrors, isMonolith bool) {
c.Kafka.Verify(configErrs, isMonolith)
c.Metrics.Verify(configErrs, isMonolith)
+ c.Sentry.Verify(configErrs, isMonolith)
c.DNSCache.Verify(configErrs, isMonolith)
}
@@ -111,6 +116,24 @@ func (c *Metrics) Defaults() {
func (c *Metrics) Verify(configErrs *ConfigErrors, isMonolith bool) {
}
+// The configuration to use for Sentry error reporting
+type Sentry struct {
+ Enabled bool `yaml:"enabled"`
+ // The DSN to connect to e.g "https://examplePublicKey@o0.ingest.sentry.io/0"
+ // See https://docs.sentry.io/platforms/go/configuration/options/
+ DSN string `yaml:"dsn"`
+ // The environment e.g "production"
+ // See https://docs.sentry.io/platforms/go/configuration/environments/
+ Environment string `yaml:"environment"`
+}
+
+func (c *Sentry) Defaults() {
+ c.Enabled = false
+}
+
+func (c *Sentry) Verify(configErrs *ConfigErrors, isMonolith bool) {
+}
+
type DatabaseOptions struct {
// The connection string, file:filename.db or postgres://server....
ConnectionString DataSource `yaml:"connection_string"`