client_golang/metrics/bucket.go

48 lines
1.1 KiB
Go
Raw Normal View History

/*
Copyright (c) 2012, Matt T. Proud
All rights reserved.
2012-05-20 01:59:25 +04:00
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
*/
2012-05-20 01:59:25 +04:00
/*
bucket.go provides fundamental interface expectations for various bucket
types.
*/
2012-05-20 01:59:25 +04:00
package metrics
/*
The Histogram class and associated types build buckets on their own.
*/
2012-05-20 01:59:25 +04:00
type BucketBuilder func() Bucket
/*
This defines the base Bucket type. The exact behaviors of the bucket are
at the whim of the implementor.
A Bucket is used as a container by Histogram as a collection for its
accumulated samples.
*/
2012-05-20 01:59:25 +04:00
type Bucket interface {
/*
Add a value to the bucket.
*/
2012-05-20 01:59:25 +04:00
Add(value float64)
/*
Provide a humanized representation hereof.
*/
2012-05-20 01:59:25 +04:00
Humanize() string
/*
Provide a count of observations throughout the bucket's lifetime.
*/
2012-05-20 01:59:25 +04:00
Observations() int
/*
Provide the value from the given in-memory value cache or an estimate
thereof for the given index. The consumer of the bucket's data makes
no assumptions about the underlying storage mechanisms that the bucket
employs.
*/
2012-05-20 01:59:25 +04:00
ValueForIndex(index int) float64
}