-
Notifications
You must be signed in to change notification settings - Fork 13
/
metrics.go
97 lines (81 loc) · 3.93 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"sigs.k8s.io/controller-runtime/pkg/metrics"
)
var (
ActualHPATargetUtilization = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "actual_hpa_utilization_target",
Help: "hpa utilization target values that hpa actually has",
}, []string{"tortoise_name", "namespace", "container_name", "resource_name", "hpa_name"})
ActualHPAMinReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "actual_hpa_minreplicas",
Help: "hpa minReplicas that hpa actually has",
}, []string{"tortoise_name", "namespace", "hpa_name"})
ActualHPAMaxReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "actual_hpa_maxreplicas",
Help: "hpa maxReplicas that hpa actually has",
}, []string{"tortoise_name", "namespace", "hpa_name"})
AppliedHPATargetUtilization = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "applied_hpa_utilization_target",
Help: "hpa utilization target values that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "container_name", "resource_name", "hpa_name"})
AppliedHPAMinReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "applied_hpa_minreplicas",
Help: "hpa minReplicas that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "hpa_name"})
AppliedHPAMaxReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "applied_hpa_maxreplicas",
Help: "hpa maxReplicas that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "hpa_name"})
AppliedCPURequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "applied_cpu_request",
Help: "cpu request (millicore) that tortoises actually applys",
}, []string{"tortoise_name", "namespace", "container_name", "controller_name", "controller_kind"})
AppliedMemoryRequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "applied_memory_request",
Help: "memory request (byte) that tortoises actually applys",
}, []string{"tortoise_name", "namespace", "container_name", "controller_name", "controller_kind"})
ProposedHPATargetUtilization = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "proposed_hpa_utilization_target",
Help: "recommended hpa utilization target values that tortoises propose",
}, []string{"tortoise_name", "namespace", "container_name", "resource_name", "hpa_name"})
ProposedHPAMinReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "proposed_hpa_minreplicas",
Help: "recommended hpa minReplicas that tortoises propose",
}, []string{"tortoise_name", "namespace", "hpa_name"})
ProposedHPAMaxReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "proposed_hpa_maxreplicas",
Help: "recommended hpa maxReplicas that tortoises propose",
}, []string{"tortoise_name", "namespace", "hpa_name"})
ProposedCPURequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "proposed_cpu_request",
Help: "recommended cpu request (millicore) that tortoises propose",
}, []string{"tortoise_name", "namespace", "container_name", "controller_name", "controller_kind"})
ProposedMemoryRequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "proposed_memory_request",
Help: "recommended memory request (byte) that tortoises propose",
}, []string{"tortoise_name", "namespace", "container_name", "controller_name", "controller_kind"})
TortoiseNumber = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "tortoise_number",
Help: "the number of tortoise",
}, []string{"tortoise_name", "namespace", "controller_name", "controller_kind", "update_mode", "tortoise_phase"})
)
func init() {
metrics.Registry.MustRegister(
ActualHPAMaxReplicas,
ActualHPAMinReplicas,
ActualHPATargetUtilization,
AppliedHPATargetUtilization,
AppliedHPAMaxReplicas,
AppliedHPAMinReplicas,
AppliedCPURequest,
AppliedMemoryRequest,
ProposedHPATargetUtilization,
ProposedHPAMinReplicas,
ProposedHPAMaxReplicas,
ProposedCPURequest,
ProposedMemoryRequest,
TortoiseNumber,
)
}