mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-03-06 03:30:26 +00:00
Merge pull request #441 from abansal4032/custom-plugin-log-fix
Generate new status log only on condition change
This commit is contained in:
@@ -135,7 +135,7 @@ func (c *customPluginMonitor) monitorLoop() {
|
||||
}
|
||||
glog.V(3).Infof("Receive new plugin result for %s: %+v", c.configPath, result)
|
||||
status := c.generateStatus(result)
|
||||
glog.Infof("New status generated: %+v", status)
|
||||
glog.V(3).Infof("New status generated: %+v", status)
|
||||
c.statusChan <- status
|
||||
case <-c.tomb.Stopping():
|
||||
c.plugin.Stop()
|
||||
@@ -263,12 +263,17 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
|
||||
}
|
||||
}
|
||||
}
|
||||
return &types.Status{
|
||||
status := &types.Status{
|
||||
Source: c.config.Source,
|
||||
// TODO(random-liu): Aggregate events and conditions and then do periodically report.
|
||||
Events: append(activeProblemEvents, inactiveProblemEvents...),
|
||||
Conditions: c.conditions,
|
||||
}
|
||||
// Log only if condition has changed
|
||||
if len(activeProblemEvents) != 0 || len(inactiveProblemEvents) != 0 {
|
||||
glog.Infof("New status generated: %+v", status)
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
func toConditionStatus(s cpmtypes.Status) types.ConditionStatus {
|
||||
|
||||
@@ -107,7 +107,9 @@ func (p *Plugin) runRules() {
|
||||
|
||||
p.resultChan <- result
|
||||
|
||||
glog.Infof("Add check result %+v for rule %+v", result, rule)
|
||||
// Let the result be logged at a higher verbosity level. If there is a change in status it is logged later.
|
||||
glog.V(3).Infof("Add check result %+v for rule %+v", result, rule)
|
||||
glog.Infof("Ran rule %+v", rule)
|
||||
}(rule)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user