refactor: fix router variable name
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
024f69b2c7
commit
d77147f7cf
1 changed files with 6 additions and 6 deletions
|
@ -325,20 +325,20 @@ func runServe(options serveOptions) error {
|
|||
return fmt.Errorf("failed to initialize server: %v", err)
|
||||
}
|
||||
|
||||
telemetryServ := http.NewServeMux()
|
||||
telemetryServ.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}))
|
||||
telemetryRouter := http.NewServeMux()
|
||||
telemetryRouter.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}))
|
||||
|
||||
// Configure health checker
|
||||
healthChecker := gosundheit.New()
|
||||
{
|
||||
handler := gosundheithttp.HandleHealthJSON(healthChecker)
|
||||
telemetryServ.Handle("/healthz", handler)
|
||||
telemetryRouter.Handle("/healthz", handler)
|
||||
|
||||
// Kubernetes style health checks
|
||||
telemetryServ.HandleFunc("/healthz/live", func(w http.ResponseWriter, _ *http.Request) {
|
||||
telemetryRouter.HandleFunc("/healthz/live", func(w http.ResponseWriter, _ *http.Request) {
|
||||
_, _ = w.Write([]byte("ok"))
|
||||
})
|
||||
telemetryServ.Handle("/healthz/ready", handler)
|
||||
telemetryRouter.Handle("/healthz/ready", handler)
|
||||
}
|
||||
|
||||
healthChecker.RegisterCheck(&gosundheit.Config{
|
||||
|
@ -352,7 +352,7 @@ func runServe(options serveOptions) error {
|
|||
|
||||
var gr run.Group
|
||||
if c.Telemetry.HTTP != "" {
|
||||
telemetrySrv := &http.Server{Addr: c.Telemetry.HTTP, Handler: telemetryServ}
|
||||
telemetrySrv := &http.Server{Addr: c.Telemetry.HTTP, Handler: telemetryRouter}
|
||||
|
||||
defer telemetrySrv.Close()
|
||||
if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil {
|
||||
|
|
Reference in a new issue