| 12345678910111213141516171819202122232425 |
- package api
- import (
- "expvar"
- "fmt"
- "net/http"
- "github.com/ncarlier/webhookd/pkg/config"
- )
- func varz(conf *config.Config) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- fmt.Fprintf(w, "{\n")
- first := true
- expvar.Do(func(kv expvar.KeyValue) {
- if !first {
- fmt.Fprintf(w, ",\n")
- }
- first = false
- fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
- })
- fmt.Fprintf(w, "\n}\n")
- })
- }
|