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 ¶
func (s *Statistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
监听数据报告
type SyncStatistics ¶
type SyncStatistics struct {
// contains filtered or unexported fields
}
并发安全版本
func NewSync ¶
func NewSync() *SyncStatistics
func (*SyncStatistics) Add ¶
func (s *SyncStatistics) Add(tag string, n int32) *SyncStatistics
添加采样数据
func (*SyncStatistics) DecrN ¶
func (s *SyncStatistics) DecrN(tag string, n int32) *SyncStatistics
减计数
func (*SyncStatistics) Get ¶
func (s *SyncStatistics) Get(tag string) (item TagItem, ok bool)
获取指定标签的数据
func (*SyncStatistics) IncrN ¶
func (s *SyncStatistics) IncrN(tag string, n int32) *SyncStatistics
增加计数
func (*SyncStatistics) Init ¶
func (s *SyncStatistics) Init(itemType string, tag string, title string)
初始化标签
func (*SyncStatistics) Set ¶
func (s *SyncStatistics) Set(tag string, data interface{}) *SyncStatistics
设置数据
func (*SyncStatistics) Watch ¶
func (s *SyncStatistics) Watch(interval time.Duration, callback func(list []ReportItem)) (cancel func())
监听数据报告
Click to show internal directories.
Click to hide internal directories.