@@ -62,6 +62,14 @@ func setupMetrics() {
6262 checkLabels ,
6363 )
6464
65+ OpsInvalidCount = prometheus .NewCounterVec (
66+ prometheus.CounterOpts {
67+ Name : "canary_check_invalid_count" ,
68+ Help : "The total number of invalid checks" ,
69+ },
70+ []string {"type" , "endpoint" , "canary_name" , "canary_namespace" , "owner" , "severity" , "key" , "name" },
71+ )
72+
6573 CanaryCheckInfo = prometheus .NewGaugeVec (
6674 prometheus.GaugeOpts {
6775 Name : "canary_check_info" ,
@@ -86,7 +94,7 @@ func setupMetrics() {
8694 checkLabels ,
8795 )
8896
89- prometheus .MustRegister (Gauge , CanaryCheckInfo , OpsCount , OpsSuccessCount , OpsFailedCount , RequestLatency )
97+ prometheus .MustRegister (Gauge , CanaryCheckInfo , OpsCount , OpsSuccessCount , OpsInvalidCount , OpsFailedCount , RequestLatency )
9098}
9199
92100var (
@@ -103,6 +111,7 @@ var (
103111 Gauge * prometheus.GaugeVec
104112
105113 // Check specific metrics
114+ OpsInvalidCount * prometheus.CounterVec
106115 OpsCount * prometheus.CounterVec
107116 OpsFailedCount * prometheus.CounterVec
108117 OpsSuccessCount * prometheus.CounterVec
@@ -259,6 +268,12 @@ func Record(
259268 }
260269 }
261270 } else {
271+ if result .Invalid {
272+ OpsInvalidCount .WithLabelValues (checkMetricLabels ... ).Inc ()
273+ } else {
274+ OpsFailedCount .WithLabelValues (checkMetricLabels ... ).Inc ()
275+ }
276+
262277 fail .Append (1 )
263278 Gauge .WithLabelValues (gaugeLabels ... ).Set (1 )
264279
@@ -272,6 +287,7 @@ func Record(
272287 } else {
273288 _latency = types.Latency {}
274289 }
290+
275291 return _uptime , _latency
276292}
277293
0 commit comments