forked from kubernetes-sigs/aws-load-balancer-controller
/
util.go
82 lines (71 loc) · 2.4 KB
/
util.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
package awsutil
import (
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/prometheus/client_golang/prometheus"
)
func init() {
prometheus.MustRegister(OnUpdateCount)
prometheus.MustRegister(ReloadCount)
prometheus.MustRegister(AWSErrorCount)
prometheus.MustRegister(ManagedIngresses)
prometheus.MustRegister(AWSCache)
prometheus.MustRegister(AWSRequest)
}
var (
// Route53svc is a pointer to the awsutil Route53 service
Route53svc *Route53
// ALBsvc is a pointer to the awsutil ELBV2 service
ALBsvc *ELBV2
// Ec2svc is a pointer to the awsutil EC2 service
Ec2svc *EC2
// ACMsvc is a pointer to the awsutil ACM service
ACMsvc *ACM
// AWSDebug turns on AWS API debug logging
AWSDebug bool
// OnUpdateCount is a counter of the controller OnUpdate calls
OnUpdateCount = prometheus.NewCounter(prometheus.CounterOpts{
Name: "albingress_updates",
Help: "Number of times OnUpdate has been called.",
},
)
// ReloadCount is a counter of the controller Reload calls
ReloadCount = prometheus.NewCounter(prometheus.CounterOpts{
Name: "albingress_reloads",
Help: "Number of times Reload has been called.",
},
)
// AWSErrorCount is a counter of AWS errors
AWSErrorCount = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "albingress_aws_errors",
Help: "Number of errors from the AWS API",
},
[]string{"service", "request"},
)
// ManagedIngresses contains the current tally of managed ingresses
ManagedIngresses = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "albingress_managed_ingresses",
Help: "Number of ingresses being managed",
})
// AWSCache contains the hits and misses to our caches
AWSCache = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "albingress_cache",
Help: "Number of ingresses being managed",
},
[]string{"cache", "action"})
// AWSRequest contains the requests made to the AWS API
AWSRequest = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "albingress_aws_requests",
Help: "Number of requests made to the AWS API",
},
[]string{"service", "operation"})
)
// Prettify wraps github.com/aws/aws-sdk-go/aws/awsutil.Prettify. Preventing the need to import it
// in each package.
func Prettify(i interface{}) string {
return awsutil.Prettify(i)
}
// DeepEqual wraps github.com/aws/aws-sdk-go/aws/awsutil.Prettify. Preventing the need to import it
// in each package.
func DeepEqual(a interface{}, b interface{}) bool {
return awsutil.DeepEqual(a, b)
}