开启qps

This commit is contained in:
ayflying
2025-04-02 15:55:43 +08:00
parent a53f7b718d
commit 7079ddab2c

View File

@@ -1,9 +1,15 @@
package aycache package aycache
import ( import (
v1 "github.com/ayflying/utility_go/api/system/v1"
"github.com/ayflying/utility_go/internal/boot"
"github.com/ayflying/utility_go/pkg/aycache/drive" "github.com/ayflying/utility_go/pkg/aycache/drive"
drive2 "github.com/ayflying/utility_go/pkg/aycache/drive" drive2 "github.com/ayflying/utility_go/pkg/aycache/drive"
"github.com/ayflying/utility_go/service"
"github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/os/gcache"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"math"
) )
type Mod struct { type Mod struct {
@@ -12,23 +18,23 @@ type Mod struct {
var ( var (
QPSCount int QPSCount int
//QPS = promauto.NewGauge( QPS = promauto.NewGauge(
// prometheus.GaugeOpts{ prometheus.GaugeOpts{
// Name: "Cache_QPS", Name: "Cache_QPS",
// Help: "当前缓存QPS数量", Help: "当前缓存QPS数量",
// }, },
//) )
) )
func init() { func init() {
//boot.AddFunc(func() { boot.AddFunc(func() {
// //初始化指标 //初始化指标
// service.SystemCron().AddCron(v1.CronType_MINUTE, func() error { service.SystemCron().AddCron(v1.CronType_MINUTE, func() error {
// QPS.Set(math.Round(float64(QPSCount) / 60)) QPS.Set(math.Round(float64(QPSCount) / 60))
// QPSCount = 0 QPSCount = 0
// return nil return nil
// }) })
//}) })
} }