Documentation ¶
Index ¶
- Variables
- type Counter
- func (c *Counter) Delta10m() int64
- func (c *Counter) Delta1h() int64
- func (c *Counter) Delta1m() int64
- func (c *Counter) Incr(delta int64)
- func (c *Counter) LastUpdate() time.Time
- func (c *Counter) Rate10m() float64
- func (c *Counter) Rate1h() float64
- func (c *Counter) Rate1m() float64
- func (c *Counter) Reset()
- func (c *Counter) Set(value int64)
- func (c *Counter) Value() int64
- type Histogram
- func (h *Histogram) Add(value int64) error
- func (h *Histogram) Delta10m() HistogramValue
- func (h *Histogram) Delta1h() HistogramValue
- func (h *Histogram) Delta1m() HistogramValue
- func (h *Histogram) LastUpdate() time.Time
- func (h *Histogram) Opts() HistogramOptions
- func (h *Histogram) Print() string
- func (h *Histogram) String() string
- func (h *Histogram) Value() HistogramValue
- type HistogramBucket
- type HistogramOptions
- type HistogramValue
- type Tracker
- func (t *Tracker) LastUpdate() time.Time
- func (t *Tracker) Max() int64
- func (t *Tracker) Max10m() int64
- func (t *Tracker) Max1h() int64
- func (t *Tracker) Max1m() int64
- func (t *Tracker) Min() int64
- func (t *Tracker) Min10m() int64
- func (t *Tracker) Min1h() int64
- func (t *Tracker) Min1m() int64
- func (t *Tracker) Push(value int64)
- func (t *Tracker) Reset()
Constants ¶
This section is empty.
Variables ¶
var ( // TimeNow is used for testing. TimeNow = time.Now )
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a counter that keeps track of its recent values over a given period of time, and with a given resolution. Use newCounter() to instantiate.
func (*Counter) LastUpdate ¶
LastUpdate returns the last update time of the counter.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
A Histogram accumulates values in the form of a histogram. The type of the values is int64, which is suitable for keeping track of things like RPC latency in milliseconds. New histogram objects should be obtained via the New() function.
func NewHistogram ¶
func NewHistogram(opts HistogramOptions) *Histogram
NewHistogram returns a pointer to a new Histogram object that was created with the provided options.
func (*Histogram) Delta10m ¶
func (h *Histogram) Delta10m() HistogramValue
Delta10m returns the change in the last 10 minutes.
func (*Histogram) Delta1h ¶
func (h *Histogram) Delta1h() HistogramValue
Delta1h returns the change in the last hour.
func (*Histogram) Delta1m ¶
func (h *Histogram) Delta1m() HistogramValue
Delta1m returns the change in the last 10 minutes.
func (*Histogram) LastUpdate ¶
LastUpdate returns the time at which the object was last updated.
func (*Histogram) Opts ¶
func (h *Histogram) Opts() HistogramOptions
Opts returns a copy of the options used to create the Histogram.
func (*Histogram) Value ¶
func (h *Histogram) Value() HistogramValue
Value returns the accumulated state of the histogram since it was created.
type HistogramBucket ¶
type HistogramBucket struct { // LowBound is the lower bound of the bucket. LowBound int64 // Count is the number of values in the bucket. Count int64 }
HistogramBucket is one histogram bucket.
type HistogramOptions ¶
type HistogramOptions struct { // NumBuckets is the number of buckets. NumBuckets int // GrowthFactor is the growth factor of the buckets. A value of 0.1 // indicates that bucket N+1 will be 10% larger than bucket N. GrowthFactor float64 // SmallestBucketSize is the size of the first bucket. Bucket sizes are // rounded down to the nearest integer. SmallestBucketSize float64 // MinValue is the lower bound of the first bucket. MinValue int64 }
HistogramOptions contains the parameters that define the histogram's buckets.
type HistogramValue ¶
type HistogramValue struct { // Count is the total number of values added to the histogram. Count int64 // Sum is the sum of all the values added to the histogram. Sum int64 // Min is the minimum of all the values added to the histogram. Min int64 // Max is the maximum of all the values added to the histogram. Max int64 // Buckets contains all the buckets of the histogram. Buckets []HistogramBucket }
HistogramValue is the value of Histogram objects.
func (HistogramValue) MarshalJSON ¶
func (v HistogramValue) MarshalJSON() ([]byte, error)
MarshalJSON marshal the HistogramValue into JSON.
func (HistogramValue) PrintChart ¶
func (v HistogramValue) PrintChart(w io.Writer)
PrintChart writes textual output of the histogram values.
func (HistogramValue) String ¶
func (v HistogramValue) String() string
String returns the textual output of the histogram values as string.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker is a min/max value tracker that keeps track of its min/max values over a given period of time, and with a given resolution. The initial min and max values are math.MaxInt64 and math.MinInt64 respectively.
func (*Tracker) LastUpdate ¶
LastUpdate returns the last update time of the range.