@@ -25,6 +25,7 @@ type Metrics struct {
2525 registry * prometheus.Registry
2626 containerImageVersion * prometheus.GaugeVec
2727 containerImageDuration * prometheus.GaugeVec
28+ containerImageErrors * prometheus.CounterVec
2829
2930 // Contains all metrics for the roundtripper
3031 roundTripper * RoundTripper
@@ -62,12 +63,23 @@ func NewServer(log *logrus.Entry) *Metrics {
6263 },
6364 []string {"namespace" , "pod" , "container" , "image" },
6465 )
66+ containerImageErrors := promauto .With (reg ).NewCounterVec (
67+ prometheus.CounterOpts {
68+ Namespace : "version_checker" ,
69+ Name : "image_failures_total" ,
70+ Help : "Total number of errors where the version-checker was unable to get the latest upstream registry version" ,
71+ },
72+ []string {
73+ "namespace" , "pod" , "container" , "image" ,
74+ },
75+ )
6576
6677 return & Metrics {
6778 log : log .WithField ("module" , "metrics" ),
6879 registry : reg ,
6980 containerImageVersion : containerImageVersion ,
7081 containerImageDuration : containerImageDuration ,
82+ containerImageErrors : containerImageErrors ,
7183 containerCache : make (map [string ]cacheItem ),
7284 roundTripper : NewRoundTripper (reg ),
7385 }
@@ -160,6 +172,11 @@ func (m *Metrics) latestImageIndex(namespace, pod, container, containerType stri
160172 return strings .Join ([]string {namespace , pod , container , containerType }, "" )
161173}
162174
175+ func (m * Metrics ) ErrorsReporting (namespace , pod , container , imageURL string ) {
176+
177+ m .containerImageErrors .WithLabelValues (namespace , pod , container , imageURL ).Inc ()
178+ }
179+
163180func (m * Metrics ) buildLabels (namespace , pod , container , containerType , imageURL , currentVersion , latestVersion string ) prometheus.Labels {
164181 return prometheus.Labels {
165182 "namespace" : namespace ,
0 commit comments