Documentation
¶
Index ¶
- func GetPkgs(showEmpty bool) []string
- func NewClient(pkg, prefix string) stats.Client
- func SetCounterParam(window, bucket time.Duration) error
- func SetHistogramParam(window, bucket time.Duration) error
- type Bin
- type Bucket
- type Counter
- type CounterSnapshot
- type HistSnapshot
- type Histogram
- type MockCounter
- type MockCtrSnapshot
- type MockHist
- type MockHistSnapshot
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient creates an instance of facebookgo/stats implementation with the given pkg name and preifx.
func SetCounterParam ¶
SetCounterParam sets the parameters of counter and histogram
func SetHistogramParam ¶
SetHistogramParam sets the parameters of counter and histogram
Types ¶
type Bin ¶
Bin represents the snapshot of a histogram bin, including bin couner and its lower and upper bound
type Bucket ¶
type Bucket struct {
Count float64
Sum float64
Min float64
Max float64
Avg float64
Start time.Time
End time.Time
}
Bucket represents the snapshot of a counter bucket, including statistics values like count, sum, average, min, max and bucket start/end time.
type Counter ¶
type Counter interface {
// Incr increments value to the counter
Incr(value float64)
// Snapshot return the snapshot of the counter
Snapshot() CounterSnapshot
}
Counter defines interface for counter
type CounterSnapshot ¶
type CounterSnapshot interface {
// SliceIn returns statistics of each bucket in the given duration
SliceIn(dur time.Duration) []Bucket
// AggrIn returns aggregration statistics in the given duration
AggrIn(dur time.Duration) Bucket
}
CounterSnapshot defines interface for accessing counter with following methods
type HistSnapshot ¶
type HistSnapshot interface {
// List histogram bins
Bins() []Bin
// Return export percentail values of the histogram
Percentiles([]float64) ([]float64, int64)
}
HistSnapshot represents a snapshot of a histogram
type Histogram ¶
type Histogram interface {
// Update add value to the histogram
Update(value float64)
// Snapshot returns the snapshot of the histogrom
Snapshot() HistSnapshot
}
Histogram defines interface for counter
type MockCounter ¶
MockCounter is mock object of Counter
func (*MockCounter) Snapshot ¶
func (m *MockCounter) Snapshot() CounterSnapshot
Snapshot mocks Snapshot()
type MockCtrSnapshot ¶
MockCtrSnapshot is mock object of CounterSnapshot
type MockHistSnapshot ¶
MockHistSnapshot is mock object of HistogramSnapshot
func (*MockHistSnapshot) Percentiles ¶
func (m *MockHistSnapshot) Percentiles(ps []float64) ([]float64, int64)
Percentiles mocks Percentiles()
type Snapshot ¶
type Snapshot interface {
CounterSnapshot
HistSnapshot
// HasHistogram returns whether this snapshot contains histogram
HasHistogram() bool
// Pkg returns the package of Histogram
Pkg() string
// Name returns the package of Histogram Name
Name() string
}
Snapshot includes CounterSnapshot, HistogramSnapshot and name
func GetSnapshot ¶
GetSnapshot returns shapshot of counters and histograms matched the given pkg and name

