Commit dc05e810 authored by Santosh Desani's avatar Santosh Desani Committed by Michael Kochell
Browse files

[MM-18277] Refactor plugin/health_check.go to use structured l… (#12734)

parent 06866952
......@@ -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))
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment