Documentation ¶
Index ¶
- func DecIntBy(d Datum, v int64, ts time.Time)
- func GetBucketsCount(d Datum) uint64
- func GetBucketsCumByMax(d Datum) map[float64]uint64
- func GetBucketsSum(d Datum) float64
- func GetFloat(d Datum) float64
- func GetInt(d Datum) int64
- func GetString(d Datum) string
- func IncIntBy(d Datum, v int64, ts time.Time)
- func Observe(d Datum, v float64, ts time.Time)
- func SetFloat(d Datum, v float64, ts time.Time)
- func SetInt(d Datum, v int64, ts time.Time)
- func SetString(d Datum, v string, ts time.Time)
- type BaseDatum
- type BucketCount
- type Buckets
- type Datum
- type Float
- type Int
- type Range
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecIntBy ¶
DecIntBy increments an integer Datum by the provided value, at time ts, or panics if the Datum is not an IntDatum.
func GetBucketsCount ¶
GetBucketCount returns the total count of observations in d, or panics if d is not a BucketsDatum.
func GetBucketsCumByMax ¶
GetBucketsCumByMax returns a map of cumulative bucket observations by their upper bonds, or panics if d is not a BucketsDatum.
func GetBucketsSum ¶
GetBucketsSum returns the sum of observations in d, or panics if d is not a BucketsDatum.
func IncIntBy ¶
IncIntBy increments an integer Datum by the provided value, at time ts, or panics if the Datum is not an IntDatum.
func Observe ¶
Observe records an observation v at time ts in d, or panics if d is not a BucketsDatum.
func SetFloat ¶
SetFloat sets a floating-point Datum to the provided value and timestamp, or panics if the Datum is not a FloatDatum.
Types ¶
type BaseDatum ¶
type BaseDatum struct {
Time int64 // nanoseconds since unix epoch
}
BaseDatum is a struct used to record timestamps across all Datum implementations.
func (*BaseDatum) TimeString ¶
TimeString returns the timestamp of this Datum as a string.
type BucketCount ¶
type Buckets ¶
Buckets describes a floating point value at a given timestamp.
func GetBuckets ¶
func (*Buckets) GetBuckets ¶
func (*Buckets) MarshalJSON ¶
func (*Buckets) ValueString ¶
type Datum ¶
type Datum interface { // ValueString returns the value of a Datum as a string. ValueString() string // TimeString returns the timestamp of a Datum as a string. TimeString() string // Time returns the timestamp of the Datum as time.Time in UTC TimeUTC() time.Time }
Datum is an interface for metric datums, with a type, value and timestamp to be exported.
func MakeBuckets ¶
MakeBuckets creates a new bucket datum with the provided list of ranges and timestamp. If no +inf bucket is provided, one is created.
func MakeFloat ¶
MakeFloat creates a new floating-point datum with the provided value and timestamp.
func MakeString ¶
MakeString creates a new string datum with the provided value and timestamp.
func NewBuckets ¶
NewBuckets creates a new zero buckets datum.
type Float ¶
Float describes a floating point value at a given timestamp.
func (*Float) MarshalJSON ¶
MarshalJSON returns a JSON encoding of the Float.
func (*Float) ValueString ¶
ValueString returns the value of the Float as a string.
type Int ¶
Int describes an integer value at a given timestamp.
func (*Int) MarshalJSON ¶
MarshalJSON returns a JSON encoding of the Int.
func (*Int) ValueString ¶
ValueString returns the value of the Int as a string.
type Range ¶
func (*Range) MarshalJSON ¶
type String ¶
String describes a string value at a given timestamp.
func (*String) MarshalJSON ¶
MarshalJSON returns a JSON encoding of the String.
func (*String) ValueString ¶
ValueString returns the value of the String as a string.