Documentation ¶
Index ¶
- func DecIntBy(d Datum, v int64, ts time.Time)
- func GetBucketsByMax(d Datum) map[float64]uint64
- func GetBucketsCount(d Datum) 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 BucketsDatum
- func (d *BucketsDatum) AddBucket(r Range)
- func (d *BucketsDatum) Buckets() map[Range]uint64
- func (d *BucketsDatum) Count() uint64
- func (d *BucketsDatum) MarshalJSON() ([]byte, error)
- func (d *BucketsDatum) Observe(v float64, ts time.Time)
- func (d *BucketsDatum) String() string
- func (d *BucketsDatum) Sum() float64
- func (*BucketsDatum) Type() Type
- func (d *BucketsDatum) ValueString() string
- type Datum
- type FloatDatum
- type IntDatum
- func (d *IntDatum) DecBy(delta int64, timestamp time.Time)
- func (d *IntDatum) Get() int64
- func (d *IntDatum) IncBy(delta int64, timestamp time.Time)
- func (d *IntDatum) MarshalJSON() ([]byte, error)
- func (d *IntDatum) Set(value int64, timestamp time.Time)
- func (d *IntDatum) String() string
- func (*IntDatum) Type() Type
- func (d *IntDatum) ValueString() string
- type Range
- type StringDatum
- type Type
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 GetBucketsByMax ¶
GetBucketsByMax returns a map of bucket observations by their upper bonds, or panics if d is not a BucketsDatum
func GetBucketsCount ¶
GetBucketCount returns the total count of observations in d, 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 BucketsDatum ¶
BucketsDatum describes a floating point value at a given timestamp.
func GetBuckets ¶
func GetBuckets(d Datum) *BucketsDatum
func (*BucketsDatum) AddBucket ¶
func (d *BucketsDatum) AddBucket(r Range)
func (*BucketsDatum) Buckets ¶
func (d *BucketsDatum) Buckets() map[Range]uint64
func (*BucketsDatum) Count ¶
func (d *BucketsDatum) Count() uint64
func (*BucketsDatum) MarshalJSON ¶
func (d *BucketsDatum) MarshalJSON() ([]byte, error)
func (*BucketsDatum) String ¶
func (d *BucketsDatum) String() string
func (*BucketsDatum) Sum ¶
func (d *BucketsDatum) Sum() float64
func (*BucketsDatum) Type ¶
func (*BucketsDatum) Type() Type
func (*BucketsDatum) ValueString ¶
func (d *BucketsDatum) ValueString() string
type Datum ¶
type Datum interface { // Type returns the Datum type. Type() Type // 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 FloatDatum ¶
FloatDatum describes a floating point value at a given timestamp.
func (*FloatDatum) MarshalJSON ¶
func (d *FloatDatum) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON encoding of the FloatDatum.
func (*FloatDatum) Set ¶
func (d *FloatDatum) Set(v float64, ts time.Time)
Set sets value of the FloatDatum at the timestamp ts.
func (*FloatDatum) String ¶
func (d *FloatDatum) String() string
String returns a string representation of the FloatDatum.
func (*FloatDatum) ValueString ¶
func (d *FloatDatum) ValueString() string
ValueString returns the value of the FloatDatum as a string.
type IntDatum ¶
IntDatum describes an integer value at a given timestamp.
func (*IntDatum) MarshalJSON ¶
MarshalJSON returns a JSON encoding of the IntDatum.
func (*IntDatum) ValueString ¶
ValueString returns the value of the IntDatum as a string.
type StringDatum ¶
StringDatum describes a string value at a given timestamp.
func (*StringDatum) Get ¶
func (d *StringDatum) Get() string
Get returns the value of the StringDatum
func (*StringDatum) MarshalJSON ¶
func (d *StringDatum) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON encoding of the StringDatum.
func (*StringDatum) Set ¶
func (d *StringDatum) Set(value string, timestamp time.Time)
Set sets the value of the StringDatum to the value at timestamp.
func (*StringDatum) String ¶
func (d *StringDatum) String() string
String returns a string representation of the StringDatum.
func (*StringDatum) Type ¶
func (*StringDatum) Type() Type
Type returns the Type of an StringDatum, String.
func (*StringDatum) ValueString ¶
func (d *StringDatum) ValueString() string
ValueString returns the value of the StringDatum as a string.