Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BreakerHandler *gobreaker.CircuitBreaker[[]byte]
Functions ¶
This section is empty.
Types ¶
type QpsCounter ¶
var (
QpsCounterHandler *QpsCounter
)
QpsCounterHandler QPS计算器
func (*QpsCounter) GetQpsCounterItem ¶
func (qc *QpsCounter) GetQpsCounterItem(serviceName string, redisCli *redis.Client) *QpsCounterItem
type QpsCounterItem ¶
type QpsCounterItem struct { RedisCli *redis.Client Requests int64 // 请求计数 StartTime time.Time // 开始时间 // contains filtered or unexported fields }
type QpsLimiter ¶
var QpsLimiterHandler *QpsLimiter
QpsLimiterHandler QPS限流器
func (*QpsLimiter) GetQpsLimiter ¶
func (ql *QpsLimiter) GetQpsLimiter(serverName string, qps float64) *QpsLimiterItem
type QpsLimiterItem ¶
type ReqCounter ¶
var (
ReqCounterHandler *ReqCounter
)
ReqCounterHandler 请求计算器
func (*ReqCounter) GetReqCounterItem ¶
func (handler *ReqCounter) GetReqCounterItem(serviceName string, redisCli *redis.Client) *ReqCounterItem
type ReqCounterItem ¶
type ReqCounterItem struct { Client *redis.Client ServiceName string // 服务名称 }
ReqCounterItem 结构体用于统计服务的请求
func (*ReqCounterItem) CleanupOldData ¶
CleanupOldData 清理指定服务的过期统计数据
func (*ReqCounterItem) GetHourlyCountsForDate ¶
func (src *ReqCounterItem) GetHourlyCountsForDate(ctx context.Context, date string) ([]int64, error)
GetHourlyCountsForDate 获取指定日期每小时的请求计数
func (*ReqCounterItem) RecordRequest ¶
func (src *ReqCounterItem) RecordRequest(ctx context.Context) error
RecordRequest 增加当前小时的请求计数
Click to show internal directories.
Click to hide internal directories.