From 50b4e2b24a6c9ee860e0c96ce3ad07b6c3fd4adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Egelund-M=C3=BCller?= Date: Fri, 15 Dec 2023 12:47:16 +0100 Subject: [PATCH] Runtime: change reconcile and parse errors to warns (#3691) * Runtime: Refactor conn cache to contain and detect hanging opens/closes * Extract connection cache to pkg + use a singleflight * Add tests * Runtime: change reconcile and parse errors to warns --- runtime/controller.go | 4 ++-- runtime/reconcilers/project_parser.go | 6 +++--- runtime/registry.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/controller.go b/runtime/controller.go index 3274dccf1e6..88d629d54ec 100644 --- a/runtime/controller.go +++ b/runtime/controller.go @@ -1123,7 +1123,7 @@ func (c *Controller) markPending(n *runtimev1.ResourceName) (skip bool, err erro } if !r.Meta.Hidden { logArgs := []any{slog.String("name", n.Name), slog.String("kind", unqualifiedKind(n.Kind)), slog.Any("error", errCyclicDependency)} - c.Logger.Error("Skipping resource", logArgs...) + c.Logger.Warn("Skipping resource", logArgs...) } return true, nil } @@ -1350,7 +1350,7 @@ func (c *Controller) processCompletedInvocation(inv *invocation) error { errorLevel = true } if errorLevel { - c.Logger.Error("Reconcile failed", logArgs...) + c.Logger.Warn("Reconcile failed", logArgs...) } else if !inv.isHidden { c.Logger.Info("Reconciled resource", logArgs...) } diff --git a/runtime/reconcilers/project_parser.go b/runtime/reconcilers/project_parser.go index cf7cadde143..10cfedf3930 100644 --- a/runtime/reconcilers/project_parser.go +++ b/runtime/reconcilers/project_parser.go @@ -244,14 +244,14 @@ func (r *ProjectParserReconciler) reconcileParser(ctx context.Context, inst *dri if skipRillYAMLErr && e.FilePath == "/rill.yaml" { continue } - r.C.Logger.Error("Parser error", slog.String("path", e.FilePath), slog.String("err", e.Message)) + r.C.Logger.Warn("Parser error", slog.String("path", e.FilePath), slog.String("err", e.Message)) } } else if diff.Skipped { - r.C.Logger.Error("Not parsing changed paths due to broken rill.yaml") + r.C.Logger.Warn("Not parsing changed paths due to broken rill.yaml") } else { for _, e := range parser.Errors { if slices.Contains(changedPaths, e.FilePath) { - r.C.Logger.Error("Parser error", slog.String("path", e.FilePath), slog.String("err", e.Message)) + r.C.Logger.Warn("Parser error", slog.String("path", e.FilePath), slog.String("err", e.Message)) } } } diff --git a/runtime/registry.go b/runtime/registry.go index 093a48e4c57..731a2dc5c7d 100644 --- a/runtime/registry.go +++ b/runtime/registry.go @@ -336,7 +336,7 @@ func (r *registryCache) restartController(iwc *instanceWithController) { r.logger.Info("syncing repo", zap.String("instance_id", iwc.instance.ID)) err := r.ensureRepoSync(iwc.ctx, iwc.instance.ID) if err != nil { - r.logger.Error("failed to sync repo", zap.String("instance_id", iwc.instance.ID), zap.Error(err)) + r.logger.Warn("failed to sync repo", zap.String("instance_id", iwc.instance.ID), zap.Error(err)) // Even if repo sync failed, we'll start the controller } else { r.logger.Info("repo synced", zap.String("instance_id", iwc.instance.ID))