Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/monitoring/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package monitoring

import (
"github.com/prometheus/client_golang/prometheus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/controller-runtime/pkg/metrics"
)

Expand Down Expand Up @@ -167,9 +168,11 @@ func Collectors() []prometheus.Collector {

// RecordReconcileError increments the per-object reconcile error counter.
// It is a no-op when err is nil, so callers can defer it unconditionally
// over a named error return value.
// over a named error return value. Conflict errors are excluded: they
// indicate a concurrent update and are expected during normal operation,
// not a reconcile failure.
func RecordReconcileError(err error, controller, name, namespace string) {
if err == nil {
if err == nil || apierrors.IsConflict(err) {
return
}
reconcileErrorsTotal.WithLabelValues(controller, name, namespace).Inc()
Expand Down