@@ -17,6 +17,7 @@ const (
17
17
labelNamespace = "namespace"
18
18
labelName = "name"
19
19
labelCondition = "condition"
20
+ labelInstance = "ss_app_kubernetes_io_instance"
20
21
)
21
22
22
23
var conditionStatusToGaugeValue = map [v1.ConditionStatus ]float64 {
@@ -47,11 +48,14 @@ var (
47
48
[]string {"reason" , "namespace" },
48
49
)
49
50
50
- conditionInfo = prometheus .NewGaugeVec (prometheus.GaugeOpts {
51
- Namespace : metricNamespace ,
52
- Name : "condition_info" ,
53
- Help : "Current SealedSecret condition status. Values are -1 (false), 0 (unknown or absent), 1 (true)" ,
54
- }, []string {labelNamespace , labelName , labelCondition })
51
+ conditionInfo = prometheus .NewGaugeVec (
52
+ prometheus.GaugeOpts {
53
+ Namespace : metricNamespace ,
54
+ Name : "condition_info" ,
55
+ Help : "Current SealedSecret condition status. Values are -1 (false), 0 (unknown or absent), 1 (true)" ,
56
+ },
57
+ []string {labelNamespace , labelName , labelCondition , labelInstance },
58
+ )
55
59
56
60
httpRequestsTotal = prometheus .NewCounterVec (
57
61
prometheus.CounterOpts {
@@ -102,6 +106,7 @@ func ObserveCondition(ssecret *v1alpha1.SealedSecret) {
102
106
labelNamespace : ssecret .Namespace ,
103
107
labelName : ssecret .Name ,
104
108
labelCondition : string (condition .Type ),
109
+ labelInstance : ssecret .Labels ["app.kubernetes.io/instance" ],
105
110
}).Set (conditionStatusToGaugeValue [condition .Status ])
106
111
}
107
112
}
@@ -112,7 +117,7 @@ func UnregisterCondition(ssecret *v1alpha1.SealedSecret) {
112
117
return
113
118
}
114
119
for _ , condition := range ssecret .Status .Conditions {
115
- conditionInfo .MetricVec .DeleteLabelValues (ssecret .Namespace , ssecret .Name , string (condition .Type ))
120
+ conditionInfo .MetricVec .DeleteLabelValues (ssecret .Namespace , ssecret .Name , string (condition .Type ), labelInstance )
116
121
}
117
122
}
118
123
0 commit comments