mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
lib/httpserver: add /ping
handler for compatibility with Influx agents
Certain Influx agents check for `/ping` endpoint before starting to send Influx line protocol data. See https://docs.influxdata.com/influxdb/v1.7/tools/api/#ping-http-endpoint
This commit is contained in:
parent
877b83ce97
commit
7c0dd85a7c
1 changed files with 9 additions and 0 deletions
|
@ -133,6 +133,15 @@ func handlerWrapper(w http.ResponseWriter, r *http.Request, rh RequestHandler) {
|
|||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Write([]byte("OK"))
|
||||
return
|
||||
case "/ping":
|
||||
// This is needed for compatibility with Influx agents.
|
||||
// See https://docs.influxdata.com/influxdb/v1.7/tools/api/#ping-http-endpoint
|
||||
status := http.StatusNoContent
|
||||
if verbose := r.FormValue("verbose"); verbose == "true" {
|
||||
status = http.StatusOK
|
||||
}
|
||||
w.WriteHeader(status)
|
||||
return
|
||||
case "/metrics":
|
||||
startTime := time.Now()
|
||||
metricsRequests.Inc()
|
||||
|
|
Loading…
Reference in a new issue