diff --git a/internal/icinga2/client.go b/internal/icinga2/client.go index 609ac473d..3e6a5840e 100644 --- a/internal/icinga2/client.go +++ b/internal/icinga2/client.go @@ -208,7 +208,7 @@ func (client *Client) startCatchupWorkers(delay time.Duration) (chan *catchupEve startTime := time.Now() catchupEventCh := make(chan *catchupEventMsg) - client.Logger.Debugw("Catch-up-phase worker has started", + client.Logger.Debugw("Starting catch-up-phase worker", zap.Stringer("worker", workerId), zap.Duration("delay", delay)) @@ -228,7 +228,7 @@ func (client *Client) startCatchupWorkers(delay time.Duration) (chan *catchupEve err := client.checkMissedChanges(groupCtx, objType, catchupEventCh) if err != nil && !errors.Is(err, context.Canceled) { - client.Logger.Debugw("Catch-up-phase event worker failed", + client.Logger.Debugw("Failed to processes catch-up-phase event streams", zap.Stringer("worker", workerId), zap.String("object_type", objType), zap.Error(err)) @@ -240,21 +240,21 @@ func (client *Client) startCatchupWorkers(delay time.Duration) (chan *catchupEve go func() { err := group.Wait() if err == nil { - client.Logger.Debugw("Catching up the API has finished", + client.Logger.Debugw("Finished catching up the API event streams", zap.Stringer("worker", workerId), zap.Duration("duration", time.Since(startTime))) } else if errors.Is(err, context.Canceled) { // The context is either canceled when the Client got canceled or, more likely, when another catch-up-worker // was requested. In the first case, the already sent messages will be discarded as the worker's main loop // was left. In the other case, the message buffers will be reset to an empty state. - client.Logger.Debugw("Catching up the API was interrupted", + client.Logger.Debugw("Interrupted catching up the API event streams", zap.Stringer("worker", workerId), zap.Duration("duration", time.Since(startTime))) } else { - client.Logger.Debugw("Catching up the API failed", + client.Logger.Debugw("Failed to catchup up the API event streams", zap.Stringer("worker", workerId), - zap.Error(err), - zap.Duration("duration", time.Since(startTime))) + zap.Duration("duration", time.Since(startTime)), + zap.Error(err)) select { case <-ctx.Done(): @@ -311,7 +311,7 @@ func (client *Client) worker() { // catchupWorkerStart starts a catch-up-phase worker and stops already running workers, if necessary. catchupWorkerStart := func() { if catchupEventCh != nil { - client.Logger.Debug("Switching to catch-up-phase was requested while still catching up, stopping old worker") + client.Logger.Debug("Received request to switch to catch-up-phase while still catching up, stopping old worker") catchupCancel() } @@ -345,9 +345,8 @@ func (client *Client) worker() { catchupWorkerDelay = min(3*time.Minute, 2*catchupWorkerDelay) } - client.Logger.Warnw("Catch-up-phase was interrupted by an error, another attempt will be made", - zap.Error(catchupMsg.error), - zap.Duration("delay", catchupWorkerDelay)) + client.Logger.Warnw("Interrupted catch-up-phase due to an error, another attempt will be made", + zap.Duration("delay", catchupWorkerDelay), zap.Error(catchupMsg.error)) catchupWorkerStart() break @@ -403,9 +402,9 @@ func (client *Client) Process() { for client.Ctx.Err() == nil { err := client.listenEventStream() if err != nil { - client.Logger.Errorw("Event Stream processing was interrupted", zap.Error(err)) + client.Logger.Errorw("Interrupted event stream processing", zap.Error(err)) } else { - client.Logger.Errorw("Event Stream processing was closed") + client.Logger.Errorw("Closed event stream processing unexpectedly") } } } diff --git a/internal/icinga2/client_api.go b/internal/icinga2/client_api.go index 39e3f02b6..786d7ab63 100644 --- a/internal/icinga2/client_api.go +++ b/internal/icinga2/client_api.go @@ -337,13 +337,12 @@ func (client *Client) connectEventStream(esTypes []string) (io.ReadCloser, error go func() { defer close(resCh) - client.Logger.Debug("Try to establish an Event Stream API connection") + client.Logger.Debug("Trying to establish an Event Stream API connection") httpClient := &http.Client{Transport: client.ApiHttpTransport} res, err := httpClient.Do(req) if err != nil { - client.Logger.Warnw("Establishing an Event Stream API connection failed, will be retried", - zap.Error(err), - zap.Duration("delay", retryDelay)) + client.Logger.Warnw("Failed to establish an Event Stream API connection, retrying", + zap.Duration("delay", retryDelay), zap.Error(err)) return }