Documentation ¶
Index ¶
- Constants
- Variables
- func D(d time.Duration) float64
- func ToD(d float64) time.Duration
- type CounterSink
- type DummySink
- type GaugeSink
- type Metric
- type MetricType
- type RateSink
- type Sample
- type Sink
- type Submetric
- type Summary
- type Threshold
- type ThresholdConfig
- type Thresholds
- type TrendSink
- type ValueType
Constants ¶
View Source
const ( Counter = MetricType(iota) // A counter that sums its data points Gauge // A gauge that displays the latest value Trend // A trend, min/max/avg/med are interesting Rate // A rate, displays % of values that aren't 0 )
Possible values for MetricType.
View Source
const ( Default = ValueType(iota) // Values are presented as-is Time // Values are timestamps (nanoseconds) Data // Values are data amounts (bytes) )
Possible values for ValueType.
Variables ¶
View Source
var ErrInvalidMetricType = errors.New("Invalid metric type")
The serialized metric type is invalid.
View Source
var ErrInvalidValueType = errors.New("Invalid value type")
The serialized value type is invalid.
Functions ¶
Types ¶
type CounterSink ¶
func (*CounterSink) Add ¶
func (c *CounterSink) Add(s Sample)
func (*CounterSink) Calc ¶ added in v0.18.0
func (c *CounterSink) Calc()
type Metric ¶
type Metric struct { Name string `json:"name"` Type MetricType `json:"type"` Contains ValueType `json:"contains"` Tainted null.Bool `json:"tainted"` Thresholds Thresholds `json:"thresholds"` Submetrics []*Submetric `json:"submetrics"` Sub Submetric `json:"sub,omitempty"` Sink Sink `json:"-"` }
A Metric defines the shape of a set of data.
func (*Metric) HumanizeValue ¶
type MetricType ¶
type MetricType int
A MetricType specifies the type of a metric.
func (MetricType) MarshalJSON ¶
func (t MetricType) MarshalJSON() ([]byte, error)
MarshalJSON serializes a MetricType as a human readable string.
func (MetricType) String ¶
func (t MetricType) String() string
func (*MetricType) UnmarshalJSON ¶
func (t *MetricType) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes a MetricType from a string representation.
type Submetric ¶ added in v0.13.0
type Submetric struct { Name string `json:"name"` Parent string `json:"parent"` Suffix string `json:"suffix"` Tags map[string]string `json:"tags"` Metric *Metric `json:"-"` }
A Submetric represents a filtered dataset based on a parent metric.
func NewSubmetric ¶ added in v0.13.0
Creates a submetric from a name.
type Threshold ¶ added in v0.13.0
type Threshold struct { Source string Failed bool AbortOnFail bool AbortGracePeriod types.NullDuration // contains filtered or unexported fields }
func NewThreshold ¶ added in v0.13.0
func (Threshold) RunNoTaint ¶ added in v0.13.0
type ThresholdConfig ¶ added in v0.20.0
type ThresholdConfig struct { Threshold string `json:"threshold"` AbortOnFail bool `json:"abortOnFail"` AbortGracePeriod types.NullDuration `json:"delayAbortEval"` }
func (ThresholdConfig) MarshalJSON ¶ added in v0.20.0
func (tc ThresholdConfig) MarshalJSON() ([]byte, error)
func (*ThresholdConfig) UnmarshalJSON ¶ added in v0.20.0
func (tc *ThresholdConfig) UnmarshalJSON(data []byte) error
type Thresholds ¶ added in v0.13.0
func NewThresholds ¶ added in v0.13.0
func NewThresholds(sources []string) (Thresholds, error)
func NewThresholdsWithConfig ¶ added in v0.20.0
func NewThresholdsWithConfig(configs []ThresholdConfig) (Thresholds, error)
func (Thresholds) MarshalJSON ¶ added in v0.13.0
func (ts Thresholds) MarshalJSON() ([]byte, error)
func (*Thresholds) RunAll ¶ added in v0.13.0
func (ts *Thresholds) RunAll(t time.Duration) (bool, error)
func (*Thresholds) UnmarshalJSON ¶ added in v0.13.0
func (ts *Thresholds) UnmarshalJSON(data []byte) error
type TrendSink ¶
type ValueType ¶
type ValueType int
The type of values a metric contains.
func (ValueType) MarshalJSON ¶
MarshalJSON serializes a ValueType as a human readable string.
func (*ValueType) UnmarshalJSON ¶
UnmarshalJSON deserializes a ValueType from a string representation.
Click to show internal directories.
Click to hide internal directories.