Documentation ¶
Index ¶
- Constants
- type ReportItem
- type Statistics
- func (s *Statistics) Add(tag string, n int32) *Statistics
- func (s *Statistics) Decr(tag string) *Statistics
- func (s *Statistics) DecrN(tag string, n int32) *Statistics
- func (s *Statistics) Flush()
- func (s *Statistics) Get(tag string) (TagItem, bool)
- func (s *Statistics) Incr(tag string) *Statistics
- func (s *Statistics) IncrN(tag string, n int32) *Statistics
- func (s *Statistics) Init(itemType string, tag string, title string)
- func (s *Statistics) Report(flush bool) []ReportItem
- func (s *Statistics) Set(tag string, data interface{}) *Statistics
- func (s *Statistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
- type SyncStatistics
- func (s *SyncStatistics) Add(tag string, n int32) *SyncStatistics
- func (s *SyncStatistics) Decr(tag string) *SyncStatistics
- func (s *SyncStatistics) DecrN(tag string, n int32) *SyncStatistics
- func (s *SyncStatistics) Flush()
- func (s *SyncStatistics) Get(tag string) (item TagItem, ok bool)
- func (s *SyncStatistics) Incr(tag string) *SyncStatistics
- func (s *SyncStatistics) IncrN(tag string, n int32) *SyncStatistics
- func (s *SyncStatistics) Init(itemType string, tag string, title string)
- func (s *SyncStatistics) Report(flush bool) []ReportItem
- func (s *SyncStatistics) Set(tag string, data interface{}) *SyncStatistics
- func (s *SyncStatistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
- type TagItem
Constants ¶
View Source
const TypeCounter = "counter"
计数器,得到 counter
View Source
const TypeData = "data"
任意数据
View Source
const TypeSamples = "samples"
采样,得到 counter, max, min, avg
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReportItem ¶
type Statistics ¶
type Statistics struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Statistics
func (*Statistics) Init ¶
func (s *Statistics) Init(itemType string, tag string, title string)
初始化标签
func (*Statistics) Watch ¶ added in v1.0.26
func (s *Statistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
监听数据报告
type SyncStatistics ¶ added in v1.0.26
type SyncStatistics struct {
// contains filtered or unexported fields
}
并发安全版本
func NewSync ¶ added in v1.0.26
func NewSync() *SyncStatistics
func (*SyncStatistics) Add ¶ added in v1.0.26
func (s *SyncStatistics) Add(tag string, n int32) *SyncStatistics
添加采样数据
func (*SyncStatistics) Decr ¶ added in v1.0.26
func (s *SyncStatistics) Decr(tag string) *SyncStatistics
减计数
func (*SyncStatistics) DecrN ¶ added in v1.0.26
func (s *SyncStatistics) DecrN(tag string, n int32) *SyncStatistics
减计数
func (*SyncStatistics) Flush ¶ added in v1.0.26
func (s *SyncStatistics) Flush()
清空统计信息(一般与 report() 配合使用)
func (*SyncStatistics) Get ¶ added in v1.0.26
func (s *SyncStatistics) Get(tag string) (item TagItem, ok bool)
获取指定标签的数据
func (*SyncStatistics) Incr ¶ added in v1.0.26
func (s *SyncStatistics) Incr(tag string) *SyncStatistics
增加计数
func (*SyncStatistics) IncrN ¶ added in v1.0.26
func (s *SyncStatistics) IncrN(tag string, n int32) *SyncStatistics
增加计数
func (*SyncStatistics) Init ¶ added in v1.0.26
func (s *SyncStatistics) Init(itemType string, tag string, title string)
初始化标签
func (*SyncStatistics) Report ¶ added in v1.0.26
func (s *SyncStatistics) Report(flush bool) []ReportItem
获得当前报告
func (*SyncStatistics) Set ¶ added in v1.0.26
func (s *SyncStatistics) Set(tag string, data interface{}) *SyncStatistics
设置数据
func (*SyncStatistics) Watch ¶ added in v1.0.26
func (s *SyncStatistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
监听数据报告
Click to show internal directories.
Click to hide internal directories.