@@ -29,14 +29,14 @@ import (
29
29
"github.com/cruise-automation/k-rail/v3/policies"
30
30
"github.com/gertd/go-pluralize"
31
31
"github.com/gorilla/mux"
32
+ "github.com/prometheus/client_golang/prometheus"
32
33
log "github.com/sirupsen/logrus"
33
34
admissionv1 "k8s.io/api/admission/v1"
34
35
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
35
36
"k8s.io/apimachinery/pkg/runtime"
36
37
"k8s.io/apimachinery/pkg/util/json"
37
38
"k8s.io/apimachinery/pkg/util/yaml"
38
39
39
- "github.com/prometheus/client_golang/prometheus"
40
40
"github.com/prometheus/client_golang/prometheus/promhttp"
41
41
"github.com/slok/go-http-metrics/middleware/std"
42
42
)
@@ -75,7 +75,9 @@ func Run(ctx context.Context) {
75
75
log .Fatal (err )
76
76
}
77
77
78
- registerMetrics ()
78
+ prometheus .MustRegister (totalRegisteredPolicies )
79
+ prometheus .MustRegister (policyViolations )
80
+ prometheus .MustRegister (totalLoadedPlugins )
79
81
80
82
loadedPlugins , err := loadPlugins (pluginsPathGlob , cfg )
81
83
if err != nil {
@@ -143,12 +145,6 @@ func Run(ctx context.Context) {
143
145
log .Fatal (s .ListenAndServeTLS (cfg .TLS .Cert , cfg .TLS .Key ))
144
146
}
145
147
146
- func registerMetrics () {
147
- prometheus .MustRegister (totalRegisteredPolicies )
148
- prometheus .MustRegister (policyViolations )
149
- prometheus .MustRegister (totalLoadedPlugins )
150
- }
151
-
152
148
func parseFlags () (string , string , string ) {
153
149
configPath := flag .String ("config" , "config.yml" , "path to configuration file" )
154
150
exemptionsPathGlob := flag .String ("exemptions-path-glob" , "" , "path glob that includes exemption configs" )
0 commit comments