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:
parent
8acb8c3e38
commit
449cd4356c
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Reference in a new issue