Skip to content

Commit 2b423ec

Browse files
authored
Merge pull request #1245 from enxebre/log-error
🌱 Add back error logging for Reconcile implementation
2 parents 9f0367a + eac2226 commit 2b423ec

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

TMP-LOGGING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ It's acceptable to log call `log.Error` with a nil error object. This
9090
conveys that an error occurred in some capacity, but that no actual
9191
`error` object was involved.
9292

93+
Errors returned by the `Reconcile` implementation of the `Reconciler` interface are commonly logged as a `Reconciler error`.
94+
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.
95+
9396
## Logging messages
9497

9598
- Don't put variable content in your messages -- use key-value pairs for

pkg/internal/controller/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ func (c *Controller) reconcileHandler(ctx context.Context, obj interface{}) {
264264
c.Queue.AddRateLimited(req)
265265
ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Inc()
266266
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, "error").Inc()
267+
log.Error(err, "Reconciler error")
267268
return
268269
} else if result.RequeueAfter > 0 {
269270
// The result.RequeueAfter request will be lost, if it is returned

0 commit comments

Comments
 (0)