mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-09-21 06:54:14 +00:00
Enable sentry reporting. (#180)
This commit adds basic sentry reporting. If enabled by setting the appropriate configuration value, it will report panics and errors. Certain functions in the core package (Delegate, Encrypt, Decrypt, Restore, and ResetPersisted) have additional Sentry reporting as these are the most common errors.
This commit is contained in:
@@ -73,6 +73,11 @@ type Metrics struct {
|
||||
Port string `json:"port"`
|
||||
}
|
||||
|
||||
// Reporting contains configuration for error reporting.
|
||||
type Reporting struct {
|
||||
SentryDSN string `json:"sentry_dsn"`
|
||||
}
|
||||
|
||||
// Delegations contains configuration for persisting delegations.
|
||||
type Delegations struct {
|
||||
// Persist controls whether delegations are persisted or not.
|
||||
@@ -100,6 +105,7 @@ type Config struct {
|
||||
UI *UI `json:"ui"`
|
||||
HipChat *HipChat `json:"hipchat"`
|
||||
Metrics *Metrics `json:"metrics"`
|
||||
Reporting *Reporting `json:"reporting"`
|
||||
Delegations *Delegations `json:"delegations"`
|
||||
}
|
||||
|
||||
@@ -126,6 +132,7 @@ func New() *Config {
|
||||
UI: &UI{},
|
||||
HipChat: &HipChat{},
|
||||
Metrics: &Metrics{},
|
||||
Reporting: &Reporting{},
|
||||
Delegations: &Delegations{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ func (m *Metrics) equal(other *Metrics) bool {
|
||||
return m.Host == other.Host && m.Port == other.Port
|
||||
}
|
||||
|
||||
func (r *Reporting) equal(other *Reporting) bool {
|
||||
return r.SentryDSN == other.SentryDSN
|
||||
}
|
||||
|
||||
func (d *Delegations) equal(other *Delegations) bool {
|
||||
return d.Persist == other.Persist && d.Policy == other.Policy
|
||||
}
|
||||
@@ -83,6 +87,10 @@ func (c *Config) equal(other *Config) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if !c.Reporting.equal(other.Reporting) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !c.Delegations.equal(other.Delegations) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user