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)
|
return fmt.Errorf("failed to initialize server: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
telemetryServ := http.NewServeMux()
|
telemetryRouter := http.NewServeMux()
|
||||||
telemetryServ.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}))
|
telemetryRouter.Handle("/metrics", promhttp.HandlerFor(prometheusRegistry, promhttp.HandlerOpts{}))
|
||||||
|
|
||||||
// Configure health checker
|
// Configure health checker
|
||||||
healthChecker := gosundheit.New()
|
healthChecker := gosundheit.New()
|
||||||
{
|
{
|
||||||
handler := gosundheithttp.HandleHealthJSON(healthChecker)
|
handler := gosundheithttp.HandleHealthJSON(healthChecker)
|
||||||
telemetryServ.Handle("/healthz", handler)
|
telemetryRouter.Handle("/healthz", handler)
|
||||||
|
|
||||||
// Kubernetes style health checks
|
// 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"))
|
_, _ = w.Write([]byte("ok"))
|
||||||
})
|
})
|
||||||
telemetryServ.Handle("/healthz/ready", handler)
|
telemetryRouter.Handle("/healthz/ready", handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
healthChecker.RegisterCheck(&gosundheit.Config{
|
healthChecker.RegisterCheck(&gosundheit.Config{
|
||||||
|
@ -352,7 +352,7 @@ func runServe(options serveOptions) error {
|
||||||
|
|
||||||
var gr run.Group
|
var gr run.Group
|
||||||
if c.Telemetry.HTTP != "" {
|
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()
|
defer telemetrySrv.Close()
|
||||||
if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil {
|
if err := listenAndShutdownGracefully(logger, &gr, telemetrySrv, "http/telemetry"); err != nil {
|
||||||
|
|
Reference in a new issue