1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: enhanced caching for user entity sets (resolve #264)

This commit is contained in:
Ferdinand Mütsch
2021-10-14 10:22:59 +02:00
parent 5fc87dd143
commit 7cae3c43d0
3 changed files with 453 additions and 434 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/muety/wakapi/services"
"github.com/muety/wakapi/utils"
"net/http"
"runtime"
"sort"
"time"
)
@ -34,6 +35,8 @@ const (
DescAdminUserHeartbeats = "Total number of tracked heartbeats by user (all time)."
DescAdminTotalUsers = "Total number of registered users."
DescAdminActiveUsers = "Number of active users."
DescGoroutines = "Total number of running goroutines"
)
type MetricsHandler struct {
@ -208,6 +211,13 @@ func (h *MetricsHandler) getUserMetrics(user *models.User) (*mm.Metrics, error)
})
}
metrics = append(metrics, &mm.CounterMetric{
Name: MetricsPrefix + "_goroutines_total",
Desc: DescGoroutines,
Value: runtime.NumGoroutine(),
Labels: []mm.Label{},
})
return &metrics, nil
}