Skip to content

Commit

Permalink
Add /quitquitquit endpoint (#36)
Browse files Browse the repository at this point in the history
* Add /quitquitquit endpoint

* Make unused parameters anonymous

* Inline function

Co-authored-by: Andreas Weiden <[email protected]>
  • Loading branch information
graipher and Andreas Weiden authored Oct 30, 2022
1 parent ce97569 commit c51c891
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"os"
"sync"
"time"

Expand Down Expand Up @@ -442,6 +443,7 @@ func main() {
prometheus.MustRegister(version.NewCollector("locustexporter"))

http.Handle(*metricsPath, promhttp.Handler())
http.HandleFunc("/quitquitquit", func(http.ResponseWriter, *http.Request) { os.Exit(0) })
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`<html><head><title>Locust Exporter</title></head><body><h1>Locust Exporter</h1><p><a href='` + *metricsPath + `'>Metrics</a></p></body></html>`))
})
Expand Down

0 comments on commit c51c891

Please sign in to comment.