feat: add IM service health and metrics endpoints
This commit is contained in:
@@ -77,18 +77,27 @@ func statsInit(mux *http.ServeMux, path string) {
|
||||
|
||||
func statsRegisterDbStats() {
|
||||
if f := store.Store.DbStats(); f != nil {
|
||||
if expvar.Get("DbStats") != nil {
|
||||
return
|
||||
}
|
||||
expvar.Publish("DbStats", expvar.Func(f))
|
||||
}
|
||||
}
|
||||
|
||||
// Register integer variable. Don't check for initialization.
|
||||
func statsRegisterInt(name string) {
|
||||
if expvar.Get(name) != nil {
|
||||
return
|
||||
}
|
||||
expvar.Publish(name, new(expvar.Int))
|
||||
}
|
||||
|
||||
// Register histogram variable. `bounds` specifies histogram buckets/bins
|
||||
// (see comment next to the `histogram` struct definition).
|
||||
func statsRegisterHistogram(name string, bounds []float64) {
|
||||
if expvar.Get(name) != nil {
|
||||
return
|
||||
}
|
||||
numBuckets := len(bounds) + 1
|
||||
expvar.Publish(name, &histogram{
|
||||
CountPerBucket: make([]int64, numBuckets),
|
||||
|
||||
Reference in New Issue
Block a user