Skip to content

Commit

Permalink
Merge pull request #1245 from enxebre/log-error
Browse files Browse the repository at this point in the history
 馃尡 Add back error logging for Reconcile implementation
  • Loading branch information
k8s-ci-robot committed Nov 9, 2020
2 parents 9f0367a + eac2226 commit 2b423ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TMP-LOGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ It's acceptable to log call `log.Error` with a nil error object. This
conveys that an error occurred in some capacity, but that no actual
`error` object was involved.

Errors returned by the `Reconcile` implementation of the `Reconciler` interface are commonly logged as a `Reconciler error`.
It's a developer choice to create an additional error log in the `Reconcile` implementation so a more specific file name and line for the error are returned.

## Logging messages

- Don't put variable content in your messages -- use key-value pairs for
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ func (c *Controller) reconcileHandler(ctx context.Context, obj interface{}) {
c.Queue.AddRateLimited(req)
ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Inc()
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, "error").Inc()
log.Error(err, "Reconciler error")
return
} else if result.RequeueAfter > 0 {
// The result.RequeueAfter request will be lost, if it is returned
Expand Down

0 comments on commit 2b423ec

Please sign in to comment.