Skip to content

Commit

Permalink
Merge pull request #308 from gocardless/rnaveiras-metrics-missing
Browse files Browse the repository at this point in the history
Revert back the metrics.Registry changes for secretinjector_webhook
  • Loading branch information
rnaveiras authored Jun 26, 2023
2 parents 8e3d28d + 185dd63 commit d7c3035
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apis/vault/v1alpha1/secretsinjector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/metrics"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

Expand Down Expand Up @@ -87,6 +88,11 @@ var (
)
)

func init() {
// Register custom metrics with the global controller runtime prometheus registry
metrics.Registry.MustRegister(handleTotal, mutateTotal, skipTotal, errorsTotal)
}

func (i *SecretsInjector) Handle(ctx context.Context, req admission.Request) (resp admission.Response) {
labels := prometheus.Labels{"pod_namespace": req.Namespace}
logger := i.logger.WithValues("uuid", string(req.UID))
Expand Down

0 comments on commit d7c3035

Please sign in to comment.