From dc05e810128752652579c8736ed65ec564638b88 Mon Sep 17 00:00:00 2001 From: Santosh Desani Date: Mon, 14 Oct 2019 13:00:23 -0500 Subject: [PATCH] =?UTF-8?q?[MM-18277]=20Refactor=20plugin/health=5Fcheck.g?= =?UTF-8?q?o=20to=20use=20structured=20l=E2=80=A6=20(#12734)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/health_check.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin/health_check.go b/plugin/health_check.go index 85989e4775..3cab84b9da 100644 --- a/plugin/health_check.go +++ b/plugin/health_check.go @@ -4,7 +4,6 @@ package plugin import ( - "fmt" "sync" "time" @@ -88,7 +87,7 @@ func (job *PluginHealthCheckJob) checkPlugin(id string) { pluginErr := sup.PerformHealthCheck() if pluginErr != nil { - mlog.Error(fmt.Sprintf("Health check failed for plugin %s, error: %s", id, pluginErr.Error())) + mlog.Error("Health check failed for plugin", mlog.String("id", id), mlog.Err(pluginErr)) job.handleHealthCheckFail(id, pluginErr) } } @@ -107,13 +106,13 @@ func (job *PluginHealthCheckJob) handleHealthCheckFail(id string, err error) { if shouldDeactivatePlugin(p) { p.failTimeStamps = []time.Time{} - mlog.Debug(fmt.Sprintf("Deactivating plugin due to multiple crashes `%s`", id)) + mlog.Debug("Deactivating plugin due to multiple crashes", mlog.String("id", id)) job.env.Deactivate(id) job.env.SetPluginState(id, model.PluginStateFailedToStayRunning) } else { - mlog.Debug(fmt.Sprintf("Restarting plugin due to failed health check `%s`", id)) + mlog.Debug("Restarting plugin due to failed health check", mlog.String("id", id)) if err := job.env.RestartPlugin(id); err != nil { - mlog.Error(fmt.Sprintf("Failed to restart plugin `%s`: %s", id, err.Error())) + mlog.Error("Failed to restart plugin", mlog.String("id", id), mlog.Err(err)) } } }