@@ -26,25 +26,25 @@ type Budget interface {
26
26
27
27
// PruneBudgetMetrics remove metrics for a Disruption Budget that doesn't exist anymore
28
28
func PruneBudgetStatusMetrics (ref nodedisruptionv1alpha1.NamespacedName ) {
29
- DisruptionBudgetDisruptions .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
30
- DisruptionBudgetWatchedNodes .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
31
- DisruptionBudgetDisruptionsAllowed .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
32
- DisruptionBudgetCurrentDisruptions .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
29
+ DisruptionBudgetDisruptions .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
30
+ DisruptionBudgetWatchedNodes .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
31
+ DisruptionBudgetDisruptionsAllowed .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
32
+ DisruptionBudgetCurrentDisruptions .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
33
33
34
- DisruptionBudgetRejectedTotal .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
35
- DisruptionBudgetGrantedTotal .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
36
- DisruptionBudgetCheckHealthHookStatusCodeTotal .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
37
- DisruptionBudgetCheckHealthHookErrorTotal .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
34
+ DisruptionBudgetRejectedTotal .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
35
+ DisruptionBudgetGrantedTotal .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
36
+ DisruptionBudgetCheckHealthHookStatusCodeTotal .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
37
+ DisruptionBudgetCheckHealthHookErrorTotal .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
38
38
}
39
39
40
40
func UpdateBudgetStatusMetrics (ref nodedisruptionv1alpha1.NamespacedName , status nodedisruptionv1alpha1.DisruptionBudgetStatus ) {
41
41
// delete before updating to avoid leaking metrics/nodes over time
42
- DisruptionBudgetWatchedNodes .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
42
+ DisruptionBudgetWatchedNodes .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
43
43
for _ , node_name := range status .WatchedNodes {
44
44
DisruptionBudgetWatchedNodes .WithLabelValues (ref .Namespace , ref .Name , ref .Kind , node_name ).Set (1 )
45
45
}
46
- // delete before updating to avoid leaking metrics/disruptions over time
47
- DisruptionBudgetDisruptions .DeletePartialMatch (prometheus.Labels {"budget_disruption_namespace " : ref .Namespace , "budget_disruption_name " : ref .Name , "budget_disruption_kind " : ref .Kind })
46
+ // delete before updating to avoid leaking metrics/disruptions over timex
47
+ DisruptionBudgetDisruptions .DeletePartialMatch (prometheus.Labels {"disruption_budget_namespace " : ref .Namespace , "disruption_budget_name " : ref .Name , "disruption_budget_kind " : ref .Kind })
48
48
for _ , disruption := range status .Disruptions {
49
49
nd_state := 0
50
50
state := nodedisruptionv1alpha1 .NodeDisruptionState (disruption .State )
0 commit comments