@@ -110,9 +110,10 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
110
110
})
111
111
timerRegistry .ObserveDuration ()
112
112
if err != nil {
113
- // Prometheus metrics - Increment the counter for the registry with error
114
113
metrics .Registry ().RequestErrorTotal .WithLabelValues (i .GetRegistry ()).Inc ()
115
114
image .SetStatusResult (v1alpha1 .ImageStatusLastSyncErrorRegistry )
115
+ k .Image ().Event (& image , corev1 .EventTypeWarning , "Fetch image" , fmt .Sprintf ("Error fetching image: %v" , err ))
116
+ log .WithError (err ).Error ("Error fetching image" )
116
117
return err
117
118
}
118
119
@@ -123,8 +124,8 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
123
124
tagsAvailable , err := re .Tags ()
124
125
timerTags .ObserveDuration ()
125
126
if err != nil {
126
- // Prometheus metrics - Increment the counter for the tags with error
127
127
metrics .Tags ().RequestErrorTotal .Inc ()
128
+ image .SetStatusResult (v1alpha1 .ImageStatusLastSyncErrorTags )
128
129
k .Image ().Event (& image , corev1 .EventTypeWarning , "Fetch image tags" , fmt .Sprintf ("Error fetching tags: %v" , err ))
129
130
log .WithError (err ).Error ("Error fetching tags" )
130
131
return err
@@ -161,8 +162,8 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
161
162
162
163
if err != nil {
163
164
// Prometheus metrics - Increment the counter for the evaluated rule with error
165
+ image .SetStatusResult (v1alpha1 .ImageStatusLastSyncError )
164
166
metrics .Rules ().EvaluatedErrorTotal .Inc ()
165
-
166
167
log .Errorf ("Error evaluating rule: %v" , err )
167
168
k .Image ().Event (& image , corev1 .EventTypeWarning , "Evaluate rule" , fmt .Sprintf ("Error evaluating rule %s: %v" , rule .Type , err ))
168
169
continue
@@ -197,7 +198,7 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
197
198
if err != nil {
198
199
// Prometheus metrics - Increment the counter for the executed action with error
199
200
metrics .Actions ().ExecutedErrorTotal .Inc ()
200
-
201
+ image . SetStatusResult ( v1alpha1 . ImageStatusLastSyncError )
201
202
log .Errorf ("Error executing action(%s): %v" , action .Type , err )
202
203
k .Image ().Event (& image , corev1 .EventTypeWarning , "Execute action" , fmt .Sprintf ("Error executing action %s: %v" , action .Type , err ))
203
204
continue
0 commit comments