Documentation
¶
Index ¶
- Variables
- func BuildFQName(namespace, subsystem, name string) string
- type Collector
- type Counter
- type CounterVec
- type Desc
- type Gauge
- type GaugeVec
- type Histogram
- type HistogramOpts
- type HistogramVType
- type HistogramVec
- type MetaData
- type Metric
- type Registry
- type RegistryOpts
- type Reporter
- type Timer
- type TimerOpts
- type TimerVType
- type TimerVec
- type ValueType
Constants ¶
This section is empty.
Variables ¶
var ( DefaultHistogramOpts = &HistogramOpts{ HVTypes: []HistogramVType{HistogramVTMin, HistogramVTMax, HistogramVTMean}, Percentiles: nil, } )
var DefaultRegistryOpts = &RegistryOpts{
CapMetricChan: defaultCapMetricChan,
CapDescChan: defaultCapDescChan,
}
DefaultRegistryOpts holds the RegistryOpts by default case.
var ( DefaultTimerOpts = &TimerOpts{ HVTypes: []TimerVType{TimerVTMin, TimerVTMax, TimerVTMean}, Percentiles: nil, } )
Functions ¶
func BuildFQName ¶
BuildFQName joins the given three name components by ".". Empty name components are ignored.
Types ¶
type Collector ¶
type Collector interface {
// Interval sets the interval of a metric collecting period.
Interval() time.Duration
// Describe sends the super-set of all possible descriptors of metrics
// collected by this Collector to the provided channel.
Describe(chan<- *Desc)
// Collect do the collecting stuffs and the implementation sends each
// collected metric via the provided channel.
Collect(ch chan<- Metric)
}
Collector is the interface implemented by anything that can be used by Reporter to report metrics. A Collector has to be registered for collection.
type Counter ¶
Counter is just a gauge for an AtomicLong instance. You can increment or decrement its value.
type CounterVec ¶
type CounterVec struct {
*Desc
// contains filtered or unexported fields
}
func NewCounterVec ¶
func (*CounterVec) Collect ¶
func (cv *CounterVec) Collect(ch chan<- Metric)
Collect implements aura.Collector.
func (*CounterVec) Describe ¶
func (cv *CounterVec) Describe(ch chan<- *Desc)
Describe implements aura.Collector.
func (*CounterVec) Interval ¶
func (cv *CounterVec) Interval() time.Duration
Interval implements aura.Collector.
func (*CounterVec) WithLabelValues ¶
func (cv *CounterVec) WithLabelValues(lvs ...string) Counter
type Desc ¶
type Desc struct {
// contains filtered or unexported fields
}
Desc is the descriptor used by every Metric.
type Gauge ¶
Gauge is an instantaneous measurement of a value. For example, we may want to measure the number of pending jobs in a queue.
type GaugeVec ¶
type GaugeVec struct {
*Desc
// contains filtered or unexported fields
}
func NewGaugeVec ¶
func (*GaugeVec) WithLabelValues ¶
type Histogram ¶
Histogram measures the statistical distribution of values in a stream of data. In addition to minimum, maximum, mean, etc. it also measures median, 75th, 90th, 95th, 98th, 99th, and 99.9th percentiles.
func NewHistogram ¶
type HistogramOpts ¶
type HistogramOpts struct {
HVTypes []HistogramVType
Percentiles []float64
}
type HistogramVType ¶
type HistogramVType string
const ( HistogramVTMin HistogramVType = "min" HistogramVTMax HistogramVType = "max" HistogramVTMean HistogramVType = "mean" HistogramVTCount HistogramVType = "count" HistogramVTStdDev HistogramVType = "stdDev" HistogramVTSum HistogramVType = "sum" HistogramVTVariance HistogramVType = "variance" )
type HistogramVec ¶
type HistogramVec struct {
*Desc
// contains filtered or unexported fields
}
func NewHistogramVec ¶
func NewHistogramVec(fqName, help string, step uint32, interval time.Duration, labelKeys []string, opts *HistogramOpts) *HistogramVec
func (*HistogramVec) Collect ¶
func (hv *HistogramVec) Collect(ch chan<- Metric)
func (*HistogramVec) Describe ¶
func (hv *HistogramVec) Describe(ch chan<- *Desc)
func (*HistogramVec) Interval ¶
func (hv *HistogramVec) Interval() time.Duration
func (*HistogramVec) WithLabelValues ¶
func (hv *HistogramVec) WithLabelValues(lvs ...string) Histogram
type MetaData ¶
type MetaData struct {
Metric string `json:"metric"`
Help string `json:"help"`
Step uint32 `json:"step"`
}
MetaData represents the metrics metadata for the `/-/metadata` API
type Metric ¶
type Metric struct {
Endpoint string
Metric string
Step uint32
Value interface{}
Type ValueType
Labels map[string]string
Timestamp int64
}
func MustNewConstMetric ¶
func NewConstMetric ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry registers aura collectors, collects their metrics.
func NewRegistry ¶
func NewRegistry(opts *RegistryOpts) *Registry
NewRegistry returns a Registry instance for managing the collecting jobs.
func (*Registry) AddReporter ¶
AddReporter adds the reporter to decide where metrics go forward.
func (*Registry) MustRegister ¶
type RegistryOpts ¶
RegistryOpts specifies the buffer size of metric channel and desc channel.
type Reporter ¶
type Reporter interface {
Report(ch chan Metric)
}
Reporter is in charge of sending metrics collected to the backend you used.
type Timer ¶
Timer measures both the rate that a particular piece of code is called and the distribution of its duration.
type TimerOpts ¶
type TimerOpts struct {
HVTypes []TimerVType
Percentiles []float64
}
type TimerVType ¶
type TimerVType string
const ( TimerVTMin TimerVType = "min" TimerVTMax TimerVType = "max" TimerVTMean TimerVType = "mean" TimerVTCount TimerVType = "count" TimerVTStdDev TimerVType = "stdDev" TimerVTSum TimerVType = "sum" TimerVTVariance TimerVType = "variance" TimerVTRate1 TimerVType = "rate1" TimerVTRate5 TimerVType = "rate5" TimerVTRate15 TimerVType = "rate15" TimerVTRateMean TimerVType = "rateMean" )
type TimerVec ¶
type TimerVec struct {
*Desc
// contains filtered or unexported fields
}