Skip to content

Commit

Permalink
Standardize log attribute key for errors (#3869)
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller authored Jan 18, 2024
1 parent 000d44f commit 47e0302
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion runtime/reconcilers/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (r *ModelReconciler) Reconcile(ctx context.Context, n *runtimev1.ResourceNa
model.State.RefreshedOn = nil
subErr := r.C.UpdateState(ctx, self.Meta.Name, self)
if subErr != nil {
r.C.Logger.Error("refs check: failed to update state", zap.Any("err", subErr))
r.C.Logger.Error("refs check: failed to update state", zap.Any("error", subErr))
}
}
return runtime.ReconcileResult{Err: err}
Expand Down
8 changes: 4 additions & 4 deletions runtime/reconcilers/project_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (r *ProjectParserReconciler) Reconcile(ctx context.Context, n *runtimev1.Re
hash, err := repo.CommitHash(ctx)
if err != nil {
// Not worth failing the reconcile for this. On error, it'll just set CurrentCommitSha to "".
r.C.Logger.Error("failed to get commit hash", zap.String("err", err.Error()))
r.C.Logger.Error("failed to get commit hash", zap.String("error", err.Error()))
}
if pp.State.CurrentCommitSha != hash {
pp.State.CurrentCommitSha = hash
Expand Down Expand Up @@ -220,7 +220,7 @@ func (r *ProjectParserReconciler) Reconcile(ctx context.Context, n *runtimev1.Re

// If the watch failed, we return without rescheduling.
// TODO: Should we have some kind of retry?
r.C.Logger.Error("Stopped watching for file changes", zap.String("err", err.Error()))
r.C.Logger.Error("Stopped watching for file changes", zap.String("error", err.Error()))
return runtime.ReconcileResult{Err: err}
}

Expand All @@ -246,14 +246,14 @@ func (r *ProjectParserReconciler) reconcileParser(ctx context.Context, inst *dri
if skipRillYAMLErr && e.FilePath == "/rill.yaml" {
continue
}
r.C.Logger.Warn("Parser error", zap.String("path", e.FilePath), zap.String("err", e.Message))
r.C.Logger.Warn("Parser error", zap.String("path", e.FilePath), zap.String("error", e.Message))
}
} else if diff.Skipped {
r.C.Logger.Warn("Not parsing changed paths due to missing or broken rill.yaml")
} else {
for _, e := range parser.Errors {
if slices.Contains(changedPaths, e.FilePath) {
r.C.Logger.Warn("Parser error", zap.String("path", e.FilePath), zap.String("err", e.Message))
r.C.Logger.Warn("Parser error", zap.String("path", e.FilePath), zap.String("error", e.Message))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/reconcilers/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (r *SourceReconciler) Reconcile(ctx context.Context, n *runtimev1.ResourceN
src.State.RefreshedOn = nil
err = r.C.UpdateState(ctx, self.Meta.Name, self)
if err != nil {
r.C.Logger.Error("refs check: failed to update state", zap.Any("err", err))
r.C.Logger.Error("refs check: failed to update state", zap.Any("error", err))
}
}
return runtime.ReconcileResult{Err: err}
Expand Down

0 comments on commit 47e0302

Please sign in to comment.