mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
optimize health_status event handling
This commit is contained in:
parent
d98ce102b1
commit
77c9001ed1
@ -87,16 +87,10 @@ func (cm *Docker) watchEvents() {
|
|||||||
|
|
||||||
for e := range events {
|
for e := range events {
|
||||||
actionName := e.Action
|
actionName := e.Action
|
||||||
// Action may have additional param i.e. "health_status: healthy"
|
|
||||||
// We need to strip to have only action name
|
|
||||||
sepIdx := strings.Index(actionName, ": ")
|
|
||||||
if sepIdx != -1 {
|
|
||||||
actionName = actionName[:sepIdx]
|
|
||||||
}
|
|
||||||
|
|
||||||
switch actionName {
|
switch actionName {
|
||||||
// most frequent event is a health checks
|
// most frequent event is a health checks
|
||||||
case "health_status":
|
case "health_status: healthy", "health_status: unhealthy":
|
||||||
|
sepIdx := strings.Index(actionName, ": ")
|
||||||
healthStatus := e.Action[sepIdx+2:]
|
healthStatus := e.Action[sepIdx+2:]
|
||||||
if log.IsEnabledFor(logging.DEBUG) {
|
if log.IsEnabledFor(logging.DEBUG) {
|
||||||
log.Debugf("handling docker event: action=health_status id=%s %s", e.ID, healthStatus)
|
log.Debugf("handling docker event: action=health_status id=%s %s", e.ID, healthStatus)
|
||||||
|
Loading…
Reference in New Issue
Block a user