From a92e7ad7de6f7396661d6a1645d0cce29b082406 Mon Sep 17 00:00:00 2001 From: Gary Hodgson Date: Mon, 30 Sep 2024 22:32:00 +0200 Subject: [PATCH 1/4] introduces TwiN/logr library --- README.md | 1 + config.yaml | 1 + config/config.go | 17 +++++++++++++++++ go.mod | 6 +++++- go.sum | 4 ++++ main.go | 17 +++++++++++++++++ watchdog/watchdog.go | 39 ++++++++++++++++++++------------------- 7 files changed, 65 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index bd78b4ec0..63f5bbba1 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ If you want to test it locally, see [Docker](#docker). | Parameter | Description | Default | |:-----------------------------|:-------------------------------------------------------------------------------------------------------------------------------------|:---------------------------| | `debug` | Whether to enable debug logs. | `false` | +| `log-level` | Log level: DEBUG, INFO, WARN, ERROR. | `INFO` | | `metrics` | Whether to expose metrics at `/metrics`. | `false` | | `storage` | [Storage configuration](#storage). | `{}` | | `alerting` | [Alerting configuration](#alerting). | `{}` | diff --git a/config.yaml b/config.yaml index f22cf7998..894f38a78 100644 --- a/config.yaml +++ b/config.yaml @@ -1,3 +1,4 @@ +log-level: INFO endpoints: - name: front-end group: core diff --git a/config/config.go b/config/config.go index 8aa61feb8..16e13831a 100644 --- a/config/config.go +++ b/config/config.go @@ -22,7 +22,9 @@ import ( "github.com/TwiN/gatus/v5/config/web" "github.com/TwiN/gatus/v5/security" "github.com/TwiN/gatus/v5/storage" + "github.com/TwiN/logr" "gopkg.in/yaml.v3" + "hermannm.dev/enumnames" ) const ( @@ -47,6 +49,13 @@ var ( // errEarlyReturn is returned to break out of a loop from a callback early errEarlyReturn = errors.New("early escape") + + LogLevels = enumnames.NewMap(map[logr.Level]string{ + logr.LevelDebug: "DEBUG", + logr.LevelInfo: "INFO", + logr.LevelWarn: "WARN", + logr.LevelError: "ERROR", + }) ) // Config is the main configuration structure @@ -54,6 +63,9 @@ type Config struct { // Debug Whether to enable debug logs Debug bool `yaml:"debug,omitempty"` + // Log level: DEBUG, INFO, WARN, ERROR. Default: INFO + LogLevel string `yaml:"log-level,omitempty"` + // Metrics Whether to expose metrics at /metrics Metrics bool `yaml:"metrics,omitempty"` @@ -204,6 +216,11 @@ func LoadConfiguration(configPath string) (*Config, error) { } config.configPath = usedConfigPath config.UpdateLastFileModTime() + + if config.LogLevel == "" { + config.LogLevel = "INFO" + } + return config, err } diff --git a/go.mod b/go.mod index f08bab4a0..e55275757 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/TwiN/gatus/v5 -go 1.22.2 +go 1.22.4 + +toolchain go1.23.0 require ( code.gitea.io/sdk/gitea v0.19.0 @@ -8,6 +10,7 @@ require ( github.com/TwiN/g8/v2 v2.0.0 github.com/TwiN/gocache/v2 v2.2.2 github.com/TwiN/health v1.6.0 + github.com/TwiN/logr v0.0.2 github.com/TwiN/whois v1.1.9 github.com/aws/aws-sdk-go v1.54.10 github.com/coreos/go-oidc/v3 v3.10.0 @@ -28,6 +31,7 @@ require ( gopkg.in/mail.v2 v2.3.1 gopkg.in/yaml.v3 v3.0.1 modernc.org/sqlite v1.33.1 + hermannm.dev/enumnames v0.2.1 ) require ( diff --git a/go.sum b/go.sum index dc74b9eb0..87d68a064 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/TwiN/gocache/v2 v2.2.2 h1:4HToPfDV8FSbaYO5kkbhLpEllUYse5rAf+hVU/mSsuI github.com/TwiN/gocache/v2 v2.2.2/go.mod h1:WfIuwd7GR82/7EfQqEtmLFC3a2vqaKbs4Pe6neB7Gyc= github.com/TwiN/health v1.6.0 h1:L2ks575JhRgQqWWOfKjw9B0ec172hx7GdToqkYUycQM= github.com/TwiN/health v1.6.0/go.mod h1:Z6TszwQPMvtSiVx1QMidVRgvVr4KZGfiwqcD7/Z+3iw= +github.com/TwiN/logr v0.0.2 h1:BGlNtfx8ni6zvylSsdB8xMv0PSTVBQf9LKtcfK24P2U= +github.com/TwiN/logr v0.0.2/go.mod h1:oldDOkRjFXjZqiMP0+ca5NAQHXTiJ02zHirsuBJJH6k= github.com/TwiN/whois v1.1.9 h1:m20+m1CXnrstie+tW2ZmAJkfcT9zgwpVRUFsKeMw+ng= github.com/TwiN/whois v1.1.9/go.mod h1:TjipCMpJRAJYKmtz/rXQBU6UGxMh6bk8SHazu7OMnQE= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= @@ -325,6 +327,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +hermannm.dev/enumnames v0.2.1 h1:e9Qw5DlF5QVoxglnSPU2gjpHtmWUByqXrig97wZ14sU= +hermannm.dev/enumnames v0.2.1/go.mod h1:Zlyt21mTyqMUcec/vMhxxSNUKkL7TVwskge2zaxOaEE= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ= diff --git a/main.go b/main.go index 31de744c9..e8cbd4073 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,8 @@ import ( "github.com/TwiN/gatus/v5/controller" "github.com/TwiN/gatus/v5/storage/store" "github.com/TwiN/gatus/v5/watchdog" + + "github.com/TwiN/logr" ) func main() { @@ -23,6 +25,8 @@ func main() { if err != nil { panic(err) } + + configureLogging(cfg) initializeStorage(cfg) start(cfg) // Wait for termination signal @@ -57,6 +61,19 @@ func save() { } } +func configureLogging(cfg *config.Config) { + + if config.LogLevels.ContainsName(cfg.LogLevel) { + log.Printf("[main.configureLogging] Log Level is %s", cfg.LogLevel) + key, ok := config.LogLevels.GetKey(cfg.LogLevel) + if ok { + logr.SetThreshold(key) + } + } else { + log.Printf("[main.configureLogging] Unrecognised log level '%s', defaulting to INFO. Allowed values are [DEBUG, INFO, WARN, ERROR]", cfg.LogLevel) + } +} + func loadConfiguration() (*config.Config, error) { configPath := os.Getenv("GATUS_CONFIG_PATH") // Backwards compatibility diff --git a/watchdog/watchdog.go b/watchdog/watchdog.go index 3fcb977ab..d7d90ac7c 100644 --- a/watchdog/watchdog.go +++ b/watchdog/watchdog.go @@ -13,6 +13,8 @@ import ( "github.com/TwiN/gatus/v5/config/maintenance" "github.com/TwiN/gatus/v5/metrics" "github.com/TwiN/gatus/v5/storage/store" + + "github.com/TwiN/logr" ) var ( @@ -31,15 +33,15 @@ func Monitor(cfg *config.Config) { if endpoint.IsEnabled() { // To prevent multiple requests from running at the same time, we'll wait for a little before each iteration time.Sleep(777 * time.Millisecond) - go monitor(endpoint, cfg.Alerting, cfg.Maintenance, cfg.Connectivity, cfg.DisableMonitoringLock, cfg.Metrics, cfg.Debug, ctx) + go monitor(endpoint, cfg.Alerting, cfg.Maintenance, cfg.Connectivity, cfg.DisableMonitoringLock, cfg.Metrics, ctx) } } } // monitor a single endpoint in a loop -func monitor(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, connectivityConfig *connectivity.Config, disableMonitoringLock, enabledMetrics, debug bool, ctx context.Context) { +func monitor(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, connectivityConfig *connectivity.Config, disableMonitoringLock bool, enabledMetrics bool, ctx context.Context) { // Run it immediately on start - execute(ep, alertingConfig, maintenanceConfig, connectivityConfig, disableMonitoringLock, enabledMetrics, debug) + execute(ep, alertingConfig, maintenanceConfig, connectivityConfig, disableMonitoringLock, enabledMetrics) // Loop for the next executions for { select { @@ -47,7 +49,7 @@ func monitor(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance log.Printf("[watchdog.monitor] Canceling current execution of group=%s; endpoint=%s", ep.Group, ep.Name) return case <-time.After(ep.Interval): - execute(ep, alertingConfig, maintenanceConfig, connectivityConfig, disableMonitoringLock, enabledMetrics, debug) + execute(ep, alertingConfig, maintenanceConfig, connectivityConfig, disableMonitoringLock, enabledMetrics) } } // Just in case somebody wandered all the way to here and wonders, "what about ExternalEndpoints?" @@ -55,7 +57,7 @@ func monitor(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance // periodically like they are for normal endpoints. } -func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, connectivityConfig *connectivity.Config, disableMonitoringLock, enabledMetrics, debug bool) { +func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenanceConfig *maintenance.Config, connectivityConfig *connectivity.Config, disableMonitoringLock bool, enabledMetrics bool) { if !disableMonitoringLock { // By placing the lock here, we prevent multiple endpoints from being monitored at the exact same time, which // could cause performance issues and return inaccurate results @@ -64,37 +66,36 @@ func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance } // If there's a connectivity checker configured, check if Gatus has internet connectivity if connectivityConfig != nil && connectivityConfig.Checker != nil && !connectivityConfig.Checker.IsConnected() { - log.Println("[watchdog.execute] No connectivity; skipping execution") + logr.Infof("[watchdog.execute] No connectivity; skipping execution") return } - if debug { - log.Printf("[watchdog.execute] Monitoring group=%s; endpoint=%s", ep.Group, ep.Name) - } + + logr.Debugf("[watchdog.execute] Monitoring group=%s; endpoint=%s", ep.Group, ep.Name) + result := ep.EvaluateHealth() if enabledMetrics { metrics.PublishMetricsForEndpoint(ep, result) } UpdateEndpointStatuses(ep, result) - if debug && !result.Success { - log.Printf("[watchdog.execute] Monitored group=%s; endpoint=%s; success=%v; errors=%d; duration=%s; body=%s", ep.Group, ep.Name, result.Success, len(result.Errors), result.Duration.Round(time.Millisecond), result.Body) + if logr.GetThreshold() == logr.LevelDebug && !result.Success { + logr.Debugf("[watchdog.execute] Monitored group=%s; endpoint=%s; success=%v; errors=%d; duration=%s; body=%s", ep.Group, ep.Name, result.Success, len(result.Errors), result.Duration.Round(time.Millisecond), result.Body) } else { - log.Printf("[watchdog.execute] Monitored group=%s; endpoint=%s; success=%v; errors=%d; duration=%s", ep.Group, ep.Name, result.Success, len(result.Errors), result.Duration.Round(time.Millisecond)) + logr.Infof("[watchdog.execute] Monitored group=%s; endpoint=%s; success=%v; errors=%d; duration=%s", ep.Group, ep.Name, result.Success, len(result.Errors), result.Duration.Round(time.Millisecond)) } if !maintenanceConfig.IsUnderMaintenance() { // TODO: Consider moving this after the monitoring lock is unlocked? I mean, how much noise can a single alerting provider cause... - HandleAlerting(ep, result, alertingConfig, debug) - } else if debug { - log.Println("[watchdog.execute] Not handling alerting because currently in the maintenance window") - } - if debug { - log.Printf("[watchdog.execute] Waiting for interval=%s before monitoring group=%s endpoint=%s again", ep.Interval, ep.Group, ep.Name) + HandleAlerting(ep, result, alertingConfig, logr.GetThreshold() == logr.LevelDebug) + } else { + logr.Debugf("[watchdog.execute] Not handling alerting because currently in the maintenance window") } + + logr.Debugf("[watchdog.execute] Waiting for interval=%s before monitoring group=%s endpoint=%s again", ep.Interval, ep.Group, ep.Name) } // UpdateEndpointStatuses updates the slice of endpoint statuses func UpdateEndpointStatuses(ep *endpoint.Endpoint, result *endpoint.Result) { if err := store.Get().Insert(ep, result); err != nil { - log.Println("[watchdog.UpdateEndpointStatuses] Failed to insert result in storage:", err.Error()) + logr.Errorf("[watchdog.UpdateEndpointStatuses] Failed to insert result in storage:", err.Error()) } } From 7bfeeda9c8613335911613a2ea6cd199b11ba1d4 Mon Sep 17 00:00:00 2001 From: Gary Hodgson Date: Tue, 1 Oct 2024 20:19:50 +0200 Subject: [PATCH 2/4] use new features of logr library --- config/config.go | 15 +-------------- go.mod | 3 +-- go.sum | 6 ++---- main.go | 12 ++---------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/config/config.go b/config/config.go index 16e13831a..8de9cf3ae 100644 --- a/config/config.go +++ b/config/config.go @@ -24,7 +24,6 @@ import ( "github.com/TwiN/gatus/v5/storage" "github.com/TwiN/logr" "gopkg.in/yaml.v3" - "hermannm.dev/enumnames" ) const ( @@ -49,13 +48,6 @@ var ( // errEarlyReturn is returned to break out of a loop from a callback early errEarlyReturn = errors.New("early escape") - - LogLevels = enumnames.NewMap(map[logr.Level]string{ - logr.LevelDebug: "DEBUG", - logr.LevelInfo: "INFO", - logr.LevelWarn: "WARN", - logr.LevelError: "ERROR", - }) ) // Config is the main configuration structure @@ -64,7 +56,7 @@ type Config struct { Debug bool `yaml:"debug,omitempty"` // Log level: DEBUG, INFO, WARN, ERROR. Default: INFO - LogLevel string `yaml:"log-level,omitempty"` + LogLevel logr.Level `yaml:"log-level,omitempty"` // Metrics Whether to expose metrics at /metrics Metrics bool `yaml:"metrics,omitempty"` @@ -216,11 +208,6 @@ func LoadConfiguration(configPath string) (*Config, error) { } config.configPath = usedConfigPath config.UpdateLastFileModTime() - - if config.LogLevel == "" { - config.LogLevel = "INFO" - } - return config, err } diff --git a/go.mod b/go.mod index e55275757..ccc1bcd54 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/TwiN/g8/v2 v2.0.0 github.com/TwiN/gocache/v2 v2.2.2 github.com/TwiN/health v1.6.0 - github.com/TwiN/logr v0.0.2 + github.com/TwiN/logr v0.2.1 github.com/TwiN/whois v1.1.9 github.com/aws/aws-sdk-go v1.54.10 github.com/coreos/go-oidc/v3 v3.10.0 @@ -31,7 +31,6 @@ require ( gopkg.in/mail.v2 v2.3.1 gopkg.in/yaml.v3 v3.0.1 modernc.org/sqlite v1.33.1 - hermannm.dev/enumnames v0.2.1 ) require ( diff --git a/go.sum b/go.sum index 87d68a064..423500b96 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/TwiN/gocache/v2 v2.2.2 h1:4HToPfDV8FSbaYO5kkbhLpEllUYse5rAf+hVU/mSsuI github.com/TwiN/gocache/v2 v2.2.2/go.mod h1:WfIuwd7GR82/7EfQqEtmLFC3a2vqaKbs4Pe6neB7Gyc= github.com/TwiN/health v1.6.0 h1:L2ks575JhRgQqWWOfKjw9B0ec172hx7GdToqkYUycQM= github.com/TwiN/health v1.6.0/go.mod h1:Z6TszwQPMvtSiVx1QMidVRgvVr4KZGfiwqcD7/Z+3iw= -github.com/TwiN/logr v0.0.2 h1:BGlNtfx8ni6zvylSsdB8xMv0PSTVBQf9LKtcfK24P2U= -github.com/TwiN/logr v0.0.2/go.mod h1:oldDOkRjFXjZqiMP0+ca5NAQHXTiJ02zHirsuBJJH6k= +github.com/TwiN/logr v0.2.1 h1:kMhUmBBVlFxzqTvyHuNoYQ/uwqg8BW4y0AyZxI5JB3Q= +github.com/TwiN/logr v0.2.1/go.mod h1:oldDOkRjFXjZqiMP0+ca5NAQHXTiJ02zHirsuBJJH6k= github.com/TwiN/whois v1.1.9 h1:m20+m1CXnrstie+tW2ZmAJkfcT9zgwpVRUFsKeMw+ng= github.com/TwiN/whois v1.1.9/go.mod h1:TjipCMpJRAJYKmtz/rXQBU6UGxMh6bk8SHazu7OMnQE= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= @@ -327,8 +327,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -hermannm.dev/enumnames v0.2.1 h1:e9Qw5DlF5QVoxglnSPU2gjpHtmWUByqXrig97wZ14sU= -hermannm.dev/enumnames v0.2.1/go.mod h1:Zlyt21mTyqMUcec/vMhxxSNUKkL7TVwskge2zaxOaEE= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ= diff --git a/main.go b/main.go index e8cbd4073..f3e5929c1 100644 --- a/main.go +++ b/main.go @@ -62,16 +62,8 @@ func save() { } func configureLogging(cfg *config.Config) { - - if config.LogLevels.ContainsName(cfg.LogLevel) { - log.Printf("[main.configureLogging] Log Level is %s", cfg.LogLevel) - key, ok := config.LogLevels.GetKey(cfg.LogLevel) - if ok { - logr.SetThreshold(key) - } - } else { - log.Printf("[main.configureLogging] Unrecognised log level '%s', defaulting to INFO. Allowed values are [DEBUG, INFO, WARN, ERROR]", cfg.LogLevel) - } + logr.SetThreshold(cfg.LogLevel) + logr.Infof("[main.configureLogging] Log Level is %s", logr.GetThreshold()) } func loadConfiguration() (*config.Config, error) { From 5d7a9484f2d290ab6be398dcbf889cf8e4f23bc1 Mon Sep 17 00:00:00 2001 From: Gary Hodgson Date: Wed, 30 Oct 2024 09:19:17 +0100 Subject: [PATCH 3/4] minor tweaks and formatting --- config/config.go | 2 +- go.mod | 2 -- main.go | 2 -- watchdog/watchdog.go | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/config/config.go b/config/config.go index 8de9cf3ae..7076798ec 100644 --- a/config/config.go +++ b/config/config.go @@ -55,7 +55,7 @@ type Config struct { // Debug Whether to enable debug logs Debug bool `yaml:"debug,omitempty"` - // Log level: DEBUG, INFO, WARN, ERROR. Default: INFO + // LogLevel is one of DEBUG, INFO, WARN and ERROR. Defaults to INFO LogLevel logr.Level `yaml:"log-level,omitempty"` // Metrics Whether to expose metrics at /metrics diff --git a/go.mod b/go.mod index ccc1bcd54..3959c1588 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/TwiN/gatus/v5 go 1.22.4 -toolchain go1.23.0 - require ( code.gitea.io/sdk/gitea v0.19.0 github.com/TwiN/deepmerge v0.2.1 diff --git a/main.go b/main.go index f3e5929c1..545764634 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,6 @@ import ( "github.com/TwiN/gatus/v5/controller" "github.com/TwiN/gatus/v5/storage/store" "github.com/TwiN/gatus/v5/watchdog" - "github.com/TwiN/logr" ) @@ -25,7 +24,6 @@ func main() { if err != nil { panic(err) } - configureLogging(cfg) initializeStorage(cfg) start(cfg) diff --git a/watchdog/watchdog.go b/watchdog/watchdog.go index d7d90ac7c..f4df9e16e 100644 --- a/watchdog/watchdog.go +++ b/watchdog/watchdog.go @@ -69,7 +69,6 @@ func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance logr.Infof("[watchdog.execute] No connectivity; skipping execution") return } - logr.Debugf("[watchdog.execute] Monitoring group=%s; endpoint=%s", ep.Group, ep.Name) result := ep.EvaluateHealth() @@ -88,7 +87,6 @@ func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance } else { logr.Debugf("[watchdog.execute] Not handling alerting because currently in the maintenance window") } - logr.Debugf("[watchdog.execute] Waiting for interval=%s before monitoring group=%s endpoint=%s again", ep.Interval, ep.Group, ep.Name) } From ec1ef26bee5312b90b54f6766534995ccbd4ded9 Mon Sep 17 00:00:00 2001 From: TwiN Date: Mon, 4 Nov 2024 18:58:30 -0500 Subject: [PATCH 4/4] Apply suggestions from code review --- config.yaml | 1 - watchdog/watchdog.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/config.yaml b/config.yaml index 894f38a78..f22cf7998 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,3 @@ -log-level: INFO endpoints: - name: front-end group: core diff --git a/watchdog/watchdog.go b/watchdog/watchdog.go index f4df9e16e..c185da50d 100644 --- a/watchdog/watchdog.go +++ b/watchdog/watchdog.go @@ -13,7 +13,6 @@ import ( "github.com/TwiN/gatus/v5/config/maintenance" "github.com/TwiN/gatus/v5/metrics" "github.com/TwiN/gatus/v5/storage/store" - "github.com/TwiN/logr" ) @@ -70,7 +69,6 @@ func execute(ep *endpoint.Endpoint, alertingConfig *alerting.Config, maintenance return } logr.Debugf("[watchdog.execute] Monitoring group=%s; endpoint=%s", ep.Group, ep.Name) - result := ep.EvaluateHealth() if enabledMetrics { metrics.PublishMetricsForEndpoint(ep, result)