refactor: fix router variable name

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-02-11 00:13:47 +01:00
parent 024f69b2c7
commit d77147f7cf
No known key found for this signature in database
GPG key ID: 34CC109EB5ED1C2A

View file

@ -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 {