mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2025-01-09 05:55:26 +00:00
remove flag and add ready endpoint
Signed-off-by: Yaron Idan <yaronidan@gmail.com>
This commit is contained in:
parent
f0c7abebb1
commit
f5e400962a
1 changed files with 15 additions and 10 deletions
25
main.go
25
main.go
|
@ -251,7 +251,6 @@ func main() {
|
||||||
var (
|
var (
|
||||||
listenAddress = kingpin.Flag("web.listen-address", "The address on which to expose the web interface and generated Prometheus metrics.").Default(":9102").String()
|
listenAddress = kingpin.Flag("web.listen-address", "The address on which to expose the web interface and generated Prometheus metrics.").Default(":9102").String()
|
||||||
enableLifecycle = kingpin.Flag("web.enable-lifecycle", "Enable shutdown and reload via HTTP request.").Default("false").Bool()
|
enableLifecycle = kingpin.Flag("web.enable-lifecycle", "Enable shutdown and reload via HTTP request.").Default("false").Bool()
|
||||||
enableHealthEndpoint = kingpin.Flag("web.enable-health-path", "Enable health check via HTTP request.").Default("true").Bool()
|
|
||||||
metricsEndpoint = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String()
|
metricsEndpoint = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String()
|
||||||
statsdListenUDP = kingpin.Flag("statsd.listen-udp", "The UDP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
statsdListenUDP = kingpin.Flag("statsd.listen-udp", "The UDP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
||||||
statsdListenTCP = kingpin.Flag("statsd.listen-tcp", "The TCP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
statsdListenTCP = kingpin.Flag("statsd.listen-tcp", "The TCP address on which to receive statsd metric lines. \"\" disables it.").Default(":9125").String()
|
||||||
|
@ -496,15 +495,21 @@ func main() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if *enableHealthEndpoint {
|
mux.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
|
||||||
mux.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
|
if r.Method == http.MethodGet {
|
||||||
if r.Method == http.MethodGet {
|
level.Debug(logger).Log("msg", "Received health check")
|
||||||
level.Debug(logger).Log("msg", "Received health check")
|
w.WriteHeader(http.StatusOK)
|
||||||
w.WriteHeader(http.StatusOK)
|
fmt.Fprintf(w, "Statsd Exporter is Healthy.\n")
|
||||||
fmt.Fprintf(w, "Statsd Exporter is Healthy.\n")
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
mux.HandleFunc("/-/ready", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method == http.MethodGet {
|
||||||
|
level.Debug(logger).Log("msg", "Received ready check")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
fmt.Fprintf(w, "Statsd Exporter is Ready.\n")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
go serveHTTP(mux, *listenAddress, logger)
|
go serveHTTP(mux, *listenAddress, logger)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue