Skip to content

Commit ea9e613

Browse files
authored
Merge pull request #126 from flant/fix_logging
fix: add log labels from task in queue handler
2 parents 8213f1b + 5cfaf88 commit ea9e613

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/shell-operator/manager_events_handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/flant/shell-operator/pkg/schedule_manager"
1212
"github.com/flant/shell-operator/pkg/task"
1313
"github.com/flant/shell-operator/pkg/task/queue"
14+
"github.com/flant/shell-operator/pkg/utils/labels"
1415
)
1516

1617
type ManagerEventsHandler struct {
@@ -88,7 +89,9 @@ func (m *ManagerEventsHandler) Start() {
8889
log.Errorf("Possible bug!!! Got task for queue '%s' but queue is not created yet. task: %s", resTask.GetQueueName(), resTask.GetDescription())
8990
} else {
9091
q.AddLast(resTask)
91-
logEntry.WithField("queue", q.Name).Infof("queue task %s", resTask.GetDescription())
92+
logEntry.WithFields(utils.LabelsToLogFields(resTask.GetLogLabels())).
93+
WithField("queue", q.Name).
94+
Infof("queue task %s", resTask.GetDescription())
9295
}
9396
}
9497
})

0 commit comments

Comments
 (0)