Skip to content

Commit

Permalink
feat(loki/src/k8s_events): check on bubbled up errors to set health a…
Browse files Browse the repository at this point in the history
…ccordingly

Signed-off-by: hainenber <[email protected]>
  • Loading branch information
hainenber committed Feb 29, 2024
1 parent 8e7825d commit 6152c7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions component/loki/source/kubernetes_events/kubernetes_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ func (c *Component) Run(ctx context.Context) error {
c.setHealth(err)
level.Error(c.log).Log("msg", "failed to apply event watchers", "err", err)
}

// Check on bubbled up errors encountered by the workers when running applied tasks
// and set component health accordingly
appliedTaskErrorString := ""
for _, err := range c.runner.GetWorkerErrors() {
appliedTaskErrorString += err.Error() + "\n"
}
if appliedTaskErrorString != "" {
c.setHealth(fmt.Errorf(appliedTaskErrorString))
}
}
}
}, func(_ error) {
Expand Down

0 comments on commit 6152c7b

Please sign in to comment.