prometheus for statistics

This commit is contained in:
skiffer-git 2022-09-14 21:42:04 +08:00
parent 375fc0c89e
commit 6a6009827c

View File

@ -28,12 +28,17 @@ func PrometheusHandler() gin.HandlerFunc {
func PromeInc(counter prometheus.Counter) {
if config.Config.Prometheus.Enable {
counter.Inc()
if counter != nil {
counter.Inc()
}
}
}
func PromeAdd(counter prometheus.Counter, add int) {
if config.Config.Prometheus.Enable {
counter.Add(float64(add))
if counter != nil {
counter.Add(float64(add))
}
}
}