1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fix: set logger in metrics server (#5319)

* set logger in metrics server

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix linter issue

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix linter issue

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
This commit is contained in:
yinka 2022-11-17 08:54:33 +00:00 committed by GitHub
parent 8acb8c3e38
commit 449cd4356c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,7 +236,13 @@ func setupMetrics(logger logr.Logger, kubeClient kubernetes.Interface) (*metrics
}
if otel == "prometheus" {
go func() {
if err := http.ListenAndServe(metricsAddr, metricsServerMux); err != nil {
metricsServer := http.Server{
Addr: metricsAddr,
Handler: metricsServerMux,
ErrorLog: logging.StdLogger(logger, ""),
ReadHeaderTimeout: 30 * time.Second,
}
if err := metricsServer.ListenAndServe(); err != nil {
logger.Error(err, "failed to enable metrics", "address", metricsAddr)
}
}()