Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultOtherMaxSize = 100 // 默认的 自定义统计字段的最大值 DefaultSCounterQpsPeriod = 1 // QPS计算周期, 默认值为1s )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SCounterBase ¶
type SCounterBase struct { sync.RWMutex Name string Cnt int64 Time string // 自定义统计指标 Other map[string]interface{} // contains filtered or unexported fields }
基本的计数器
func NewSCounterBase ¶
func NewSCounterBase(name string) *SCounterBase
func (*SCounterBase) Get ¶
func (this *SCounterBase) Get() *SCounterBase
func (*SCounterBase) PutOther ¶
func (this *SCounterBase) PutOther(key string, value interface{}) bool
func (*SCounterBase) SetCnt ¶
func (this *SCounterBase) SetCnt(cnt int64)
type SCounterQps ¶
type SCounterQps struct { sync.RWMutex Name string Cnt int64 Qps int64 Time string // 自定义统计指标 Other map[string]interface{} // contains filtered or unexported fields }
QPS统计,只支持 增加计数操作
func NewSCounterQps ¶
func NewSCounterQps(name string) *SCounterQps
func (*SCounterQps) Get ¶
func (this *SCounterQps) Get() *SCounterQps
func (*SCounterQps) Incr ¶
func (this *SCounterQps) Incr()
func (*SCounterQps) IncrBy ¶
func (this *SCounterQps) IncrBy(incr int64)
func (*SCounterQps) PutOther ¶
func (this *SCounterQps) PutOther(key string, value interface{}) bool
Click to show internal directories.
Click to hide internal directories.