@@ -11,6 +11,14 @@ import (
11
11
var templateInstancesTotal = prometheus .NewGaugeVec (
12
12
prometheus.GaugeOpts {
13
13
Name : "openshift_template_instance_total" ,
14
+ Help : "Counts TemplateInstance objects" ,
15
+ },
16
+ nil ,
17
+ )
18
+
19
+ var templateInstanceStatusCondition = prometheus .NewGaugeVec (
20
+ prometheus.GaugeOpts {
21
+ Name : "openshift_template_instance_status_condition_total" ,
14
22
Help : "Counts TemplateInstance objects by condition type and status" ,
15
23
},
16
24
[]string {"type" , "status" },
@@ -26,6 +34,7 @@ var templateInstancesActiveStartTime = prometheus.NewGaugeVec(
26
34
27
35
func (c * TemplateInstanceController ) Describe (ch chan <- * prometheus.Desc ) {
28
36
templateInstancesTotal .Describe (ch )
37
+ templateInstanceStatusCondition .Describe (ch )
29
38
templateInstancesActiveStartTime .Describe (ch )
30
39
}
31
40
@@ -37,17 +46,18 @@ func (c *TemplateInstanceController) Collect(ch chan<- prometheus.Metric) {
37
46
}
38
47
39
48
templateInstancesTotal .Reset ()
49
+ templateInstanceStatusCondition .Reset ()
40
50
templateInstancesActiveStartTime .Reset ()
41
51
42
- templateInstancesTotal .WithLabelValues ("" , "" ).Set (0 )
52
+ templateInstancesTotal .WithLabelValues ().Set (0 )
43
53
44
54
for _ , templateInstance := range templateInstances {
45
55
waiting := true
46
56
47
- templateInstancesTotal .WithLabelValues ("" , "" ).Inc ()
57
+ templateInstancesTotal .WithLabelValues ().Inc ()
48
58
49
59
for _ , cond := range templateInstance .Status .Conditions {
50
- templateInstancesTotal .WithLabelValues (string (cond .Type ), string (cond .Status )).Inc ()
60
+ templateInstanceStatusCondition .WithLabelValues (string (cond .Type ), string (cond .Status )).Inc ()
51
61
52
62
if cond .Status == kapi .ConditionTrue &&
53
63
(cond .Type == templateapi .TemplateInstanceInstantiateFailure || cond .Type == templateapi .TemplateInstanceReady ) {
@@ -61,5 +71,6 @@ func (c *TemplateInstanceController) Collect(ch chan<- prometheus.Metric) {
61
71
}
62
72
63
73
templateInstancesTotal .Collect (ch )
74
+ templateInstanceStatusCondition .Collect (ch )
64
75
templateInstancesActiveStartTime .Collect (ch )
65
76
}
0 commit comments