Documentation ¶
Index ¶
- Constants
- Variables
- func AddCounter(group string, service string, key string, value int64)
- func AddGauge(group string, service string, key string, value int64)
- func AddHistograms(group string, service string, key string, duration int64)
- func AddWriter(key string, sw StatWriter)
- func ClearStatItems()
- func ElapseTimeSuffix(t int64) string
- func Escape(s string) string
- func GenGraphiteMessages(localIP string, snapshots []Snapshot) []string
- func RMStatItem(group string, service string)
- func RangeAllStatItem(f func(k string, v StatItem) bool)
- func RegisterStatusSampleFunc(key string, sf func() int64)
- func RegisterStatusSampler(key string, sampler StatusSampler)
- func StartReporter(ctx *motan.Context)
- func StatItemSize() int
- func UnregisterStatusSampler(key string)
- type DefaultStatItem
- func (d *DefaultStatItem) AddCounter(key string, value int64)
- func (d *DefaultStatItem) AddGauge(key string, value int64)
- func (d *DefaultStatItem) AddHistograms(key string, duration int64)
- func (d *DefaultStatItem) Clear()
- func (d *DefaultStatItem) Count(key string) (i int64)
- func (d *DefaultStatItem) GetGroup() string
- func (d *DefaultStatItem) GetService() string
- func (d *DefaultStatItem) IsCounter(key string) bool
- func (d *DefaultStatItem) IsGauge(key string) bool
- func (d *DefaultStatItem) IsHistogram(key string) bool
- func (d *DefaultStatItem) IsReport() bool
- func (d *DefaultStatItem) LastSnapshot() Snapshot
- func (d *DefaultStatItem) Max(key string) int64
- func (d *DefaultStatItem) Mean(key string) float64
- func (d *DefaultStatItem) Min(key string) int64
- func (d *DefaultStatItem) P90(key string) float64
- func (d *DefaultStatItem) P95(key string) float64
- func (d *DefaultStatItem) P99(key string) float64
- func (d *DefaultStatItem) P999(key string) float64
- func (d *DefaultStatItem) Percentile(key string, f float64) float64
- func (d *DefaultStatItem) Percentiles(key string, f []float64) []float64
- func (d *DefaultStatItem) RangeKey(f func(k string))
- func (d *DefaultStatItem) Remove(key string)
- func (d *DefaultStatItem) SetGroup(group string)
- func (d *DefaultStatItem) SetReport(b bool)
- func (d *DefaultStatItem) SetService(service string)
- func (d *DefaultStatItem) Snapshot() Snapshot
- func (d *DefaultStatItem) SnapshotAndClear() Snapshot
- func (d *DefaultStatItem) SnapshotAndClearV0() Snapshot
- func (d *DefaultStatItem) Sum(key string) int64
- func (d *DefaultStatItem) Value(key string) int64
- type ReadonlyStatItem
- func (d *ReadonlyStatItem) AddCounter(key string, value int64)
- func (d *ReadonlyStatItem) AddGauge(key string, value int64)
- func (d *ReadonlyStatItem) AddHistograms(key string, duration int64)
- func (d *ReadonlyStatItem) Clear()
- func (d *ReadonlyStatItem) Count(key string) (i int64)
- func (d *ReadonlyStatItem) GetGroup() string
- func (d *ReadonlyStatItem) GetService() string
- func (d *ReadonlyStatItem) IsCounter(key string) bool
- func (d *ReadonlyStatItem) IsGauge(key string) bool
- func (d *ReadonlyStatItem) IsHistogram(key string) bool
- func (d *ReadonlyStatItem) IsReport() bool
- func (d *ReadonlyStatItem) LastSnapshot() Snapshot
- func (d *ReadonlyStatItem) Max(key string) int64
- func (d *ReadonlyStatItem) Mean(key string) float64
- func (d *ReadonlyStatItem) Min(key string) int64
- func (d *ReadonlyStatItem) P90(key string) float64
- func (d *ReadonlyStatItem) P95(key string) float64
- func (d *ReadonlyStatItem) P99(key string) float64
- func (d *ReadonlyStatItem) P999(key string) float64
- func (d *ReadonlyStatItem) Percentile(key string, f float64) float64
- func (d *ReadonlyStatItem) Percentiles(key string, f []float64) []float64
- func (d *ReadonlyStatItem) RangeKey(f func(k string))
- func (d *ReadonlyStatItem) Remove(key string)
- func (d *ReadonlyStatItem) SetGroup(group string)
- func (d *ReadonlyStatItem) SetReport(b bool)
- func (d *ReadonlyStatItem) SetService(service string)
- func (d *ReadonlyStatItem) Snapshot() Snapshot
- func (d *ReadonlyStatItem) SnapshotAndClear() Snapshot
- func (d *ReadonlyStatItem) Sum(key string) int64
- func (d *ReadonlyStatItem) Value(key string) int64
- type RegistryHolder
- type Snapshot
- type StatItem
- type StatWriter
- type StatusSampleFunc
- type StatusSampler
Constants ¶
View Source
const ( KeyDelimiter = ":" DefaultStatGroup = "motan-stat" DefaultStatService = "status" DefaultStatRole = "motan-agent" DefaultStatApplication = "unknown" )
Variables ¶
View Source
var ( // NewStatItem is the factory func for StatItem NewStatItem = NewDefaultStatItem )
Functions ¶
func AddWriter ¶
func AddWriter(key string, sw StatWriter)
func ClearStatItems ¶
func ClearStatItems()
func ElapseTimeSuffix ¶
func GenGraphiteMessages ¶
func RMStatItem ¶
func RangeAllStatItem ¶
func RegisterStatusSampler ¶
func RegisterStatusSampler(key string, sampler StatusSampler)
func StartReporter ¶
func StatItemSize ¶
func StatItemSize() int
func UnregisterStatusSampler ¶
func UnregisterStatusSampler(key string)
Types ¶
type DefaultStatItem ¶
type DefaultStatItem struct {
// contains filtered or unexported fields
}
func (*DefaultStatItem) AddCounter ¶
func (d *DefaultStatItem) AddCounter(key string, value int64)
func (*DefaultStatItem) AddGauge ¶
func (d *DefaultStatItem) AddGauge(key string, value int64)
func (*DefaultStatItem) AddHistograms ¶
func (d *DefaultStatItem) AddHistograms(key string, duration int64)
func (*DefaultStatItem) Clear ¶
func (d *DefaultStatItem) Clear()
func (*DefaultStatItem) Count ¶
func (d *DefaultStatItem) Count(key string) (i int64)
func (*DefaultStatItem) GetGroup ¶
func (d *DefaultStatItem) GetGroup() string
func (*DefaultStatItem) GetService ¶
func (d *DefaultStatItem) GetService() string
func (*DefaultStatItem) IsCounter ¶
func (d *DefaultStatItem) IsCounter(key string) bool
func (*DefaultStatItem) IsGauge ¶
func (d *DefaultStatItem) IsGauge(key string) bool
func (*DefaultStatItem) IsHistogram ¶
func (d *DefaultStatItem) IsHistogram(key string) bool
func (*DefaultStatItem) IsReport ¶
func (d *DefaultStatItem) IsReport() bool
func (*DefaultStatItem) LastSnapshot ¶
func (d *DefaultStatItem) LastSnapshot() Snapshot
func (*DefaultStatItem) Max ¶
func (d *DefaultStatItem) Max(key string) int64
func (*DefaultStatItem) Mean ¶
func (d *DefaultStatItem) Mean(key string) float64
func (*DefaultStatItem) Min ¶
func (d *DefaultStatItem) Min(key string) int64
func (*DefaultStatItem) P90 ¶
func (d *DefaultStatItem) P90(key string) float64
func (*DefaultStatItem) P95 ¶
func (d *DefaultStatItem) P95(key string) float64
func (*DefaultStatItem) P99 ¶
func (d *DefaultStatItem) P99(key string) float64
func (*DefaultStatItem) P999 ¶
func (d *DefaultStatItem) P999(key string) float64
func (*DefaultStatItem) Percentile ¶
func (d *DefaultStatItem) Percentile(key string, f float64) float64
func (*DefaultStatItem) Percentiles ¶
func (d *DefaultStatItem) Percentiles(key string, f []float64) []float64
Percentiles : return value is nil while key not exist
func (*DefaultStatItem) RangeKey ¶
func (d *DefaultStatItem) RangeKey(f func(k string))
func (*DefaultStatItem) Remove ¶
func (d *DefaultStatItem) Remove(key string)
func (*DefaultStatItem) SetGroup ¶
func (d *DefaultStatItem) SetGroup(group string)
func (*DefaultStatItem) SetReport ¶
func (d *DefaultStatItem) SetReport(b bool)
func (*DefaultStatItem) SetService ¶
func (d *DefaultStatItem) SetService(service string)
func (*DefaultStatItem) Snapshot ¶
func (d *DefaultStatItem) Snapshot() Snapshot
func (*DefaultStatItem) SnapshotAndClear ¶
func (d *DefaultStatItem) SnapshotAndClear() Snapshot
SnapshotAndClear acquires Snapshot(ReadonlyStatItem), and it calculates metrics without locker, higher performance.
func (*DefaultStatItem) SnapshotAndClearV0 ¶
func (d *DefaultStatItem) SnapshotAndClearV0() Snapshot
Deprecated. Using SnapshotAndClear instead. Because of Snapshot(DefaultStatItem) calculates metrics will call locker to do that, cause low performance
func (*DefaultStatItem) Sum ¶
func (d *DefaultStatItem) Sum(key string) int64
func (*DefaultStatItem) Value ¶
func (d *DefaultStatItem) Value(key string) int64
type ReadonlyStatItem ¶
type ReadonlyStatItem struct {
// contains filtered or unexported fields
}
func (*ReadonlyStatItem) AddCounter ¶
func (d *ReadonlyStatItem) AddCounter(key string, value int64)
func (*ReadonlyStatItem) AddGauge ¶
func (d *ReadonlyStatItem) AddGauge(key string, value int64)
func (*ReadonlyStatItem) AddHistograms ¶
func (d *ReadonlyStatItem) AddHistograms(key string, duration int64)
func (*ReadonlyStatItem) Clear ¶
func (d *ReadonlyStatItem) Clear()
func (*ReadonlyStatItem) Count ¶
func (d *ReadonlyStatItem) Count(key string) (i int64)
func (*ReadonlyStatItem) GetGroup ¶
func (d *ReadonlyStatItem) GetGroup() string
func (*ReadonlyStatItem) GetService ¶
func (d *ReadonlyStatItem) GetService() string
func (*ReadonlyStatItem) IsCounter ¶
func (d *ReadonlyStatItem) IsCounter(key string) bool
func (*ReadonlyStatItem) IsGauge ¶
func (d *ReadonlyStatItem) IsGauge(key string) bool
func (*ReadonlyStatItem) IsHistogram ¶
func (d *ReadonlyStatItem) IsHistogram(key string) bool
func (*ReadonlyStatItem) IsReport ¶
func (d *ReadonlyStatItem) IsReport() bool
func (*ReadonlyStatItem) LastSnapshot ¶
func (d *ReadonlyStatItem) LastSnapshot() Snapshot
func (*ReadonlyStatItem) Max ¶
func (d *ReadonlyStatItem) Max(key string) int64
func (*ReadonlyStatItem) Mean ¶
func (d *ReadonlyStatItem) Mean(key string) float64
func (*ReadonlyStatItem) Min ¶
func (d *ReadonlyStatItem) Min(key string) int64
func (*ReadonlyStatItem) P90 ¶
func (d *ReadonlyStatItem) P90(key string) float64
func (*ReadonlyStatItem) P95 ¶
func (d *ReadonlyStatItem) P95(key string) float64
func (*ReadonlyStatItem) P99 ¶
func (d *ReadonlyStatItem) P99(key string) float64
func (*ReadonlyStatItem) P999 ¶
func (d *ReadonlyStatItem) P999(key string) float64
func (*ReadonlyStatItem) Percentile ¶
func (d *ReadonlyStatItem) Percentile(key string, f float64) float64
func (*ReadonlyStatItem) Percentiles ¶
func (d *ReadonlyStatItem) Percentiles(key string, f []float64) []float64
Percentiles : return value is nil while key not exist
func (*ReadonlyStatItem) RangeKey ¶
func (d *ReadonlyStatItem) RangeKey(f func(k string))
func (*ReadonlyStatItem) Remove ¶
func (d *ReadonlyStatItem) Remove(key string)
func (*ReadonlyStatItem) SetGroup ¶
func (d *ReadonlyStatItem) SetGroup(group string)
func (*ReadonlyStatItem) SetReport ¶
func (d *ReadonlyStatItem) SetReport(b bool)
func (*ReadonlyStatItem) SetService ¶
func (d *ReadonlyStatItem) SetService(service string)
func (*ReadonlyStatItem) Snapshot ¶
func (d *ReadonlyStatItem) Snapshot() Snapshot
func (*ReadonlyStatItem) SnapshotAndClear ¶
func (d *ReadonlyStatItem) SnapshotAndClear() Snapshot
func (*ReadonlyStatItem) Sum ¶
func (d *ReadonlyStatItem) Sum(key string) int64
func (*ReadonlyStatItem) Value ¶
func (d *ReadonlyStatItem) Value(key string) int64
type RegistryHolder ¶
type RegistryHolder struct {
// contains filtered or unexported fields
}
type Snapshot ¶
type Snapshot interface { StatItem Count(key string) int64 Sum(key string) int64 Max(key string) int64 Mean(key string) float64 Min(key string) int64 P90(key string) float64 P95(key string) float64 P99(key string) float64 P999(key string) float64 Percentile(key string, v float64) float64 Percentiles(key string, f []float64) []float64 Value(key string) int64 RangeKey(f func(k string)) IsHistogram(key string) bool IsCounter(key string) bool IsGauge(key string) bool }
type StatItem ¶
type StatItem interface { SetService(service string) GetService() string SetGroup(group string) GetGroup() string AddCounter(key string, value int64) AddHistograms(key string, duration int64) AddGauge(key string, value int64) Snapshot() Snapshot SnapshotAndClear() Snapshot LastSnapshot() Snapshot SetReport(b bool) IsReport() bool Remove(key string) Clear() }
func GetOrRegisterStatItem ¶
func GetStatItem ¶
func NewDefaultStatItem ¶
NewDefaultStatItem create a new statistic item, you should escape input parameter before call this function
type StatWriter ¶
type StatusSampleFunc ¶
type StatusSampleFunc func() int64
func (StatusSampleFunc) Sample ¶
func (f StatusSampleFunc) Sample() int64
type StatusSampler ¶
type StatusSampler interface {
Sample() int64
}
Click to show internal directories.
Click to hide internal directories.