Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pgbouncer_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func main() {
prometheus.MustRegister(procExporter)
}

http.Handle(*metricsPath, promhttp.Handler())
mux := http.NewServeMux()
mux.Handle(*metricsPath, promhttp.Handler())

if *metricsPath != "/" && *metricsPath != "" {
landingConfig := web.LandingConfig{
Name: "PgBouncer Exporter",
Expand All @@ -93,15 +95,20 @@ func main() {
},
},
}

landingPage, err := web.NewLandingPage(landingConfig)
if err != nil {
logger.Error("Error creating landing page", "err", err)
os.Exit(1)
}
http.Handle("/", landingPage)

mux.Handle("/", landingPage)
}

srv := &http.Server{
Handler: mux,
}

srv := &http.Server{}
if err := web.ListenAndServe(srv, toolkitFlags, logger); err != nil {
logger.Error("Error starting server", "err", err)
os.Exit(1)
Expand Down