Documentation
¶
Index ¶
- Constants
- type DelegatingReporter
- func (self *DelegatingReporter) Start(interval time.Duration)
- func (self *DelegatingReporter) VisitFloatMetric(name string, val float64, extra string)
- func (self *DelegatingReporter) VisitGauge(name string, gauge Gauge)
- func (self *DelegatingReporter) VisitGaugeFloat64(name string, gauge GaugeFloat64)
- func (self *DelegatingReporter) VisitHistogram(name string, metric Histogram)
- func (self *DelegatingReporter) VisitIntMetric(name string, val int64, extra string)
- func (self *DelegatingReporter) VisitMeter(name string, metric Meter)
- func (self *DelegatingReporter) VisitPercentileMetric(name string, val PercentileSource, extra string)
- func (self *DelegatingReporter) VisitTimer(name string, metric Timer)
- type Gauge
- type GaugeFloat64
- type Handler
- type Histogram
- type IntervalCounter
- type Meter
- type Metric
- type MetricSink
- type PercentileSource
- type Registry
- type Timer
- type UsageCounter
- type UsageRegistry
- type UsageRegistryConfig
- type UsageSource
- type Visitor
Constants ¶
View Source
const ( MetricNameCount = "count" MetricNameMean = "mean" MetricNameRateM1 = "rate_m1" MetricNameRateM5 = "rate_m5" MetricNameRateM15 = "rate_m15" MetricNameMin = "min" MetricNameMax = "max" MetricNamePercentile = "percentile" )
View Source
const ( DefaultIntervalAgeThreshold = 80 * time.Second MinEventQueueSize = 16 DefaultEventQueueSize = 256 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DelegatingReporter ¶ added in v1.4.1
type DelegatingReporter struct {
// contains filtered or unexported fields
}
func NewDelegatingReporter ¶ added in v1.4.1
func NewDelegatingReporter(registry Registry, sink MetricSink, closeNotify <-chan struct{}) *DelegatingReporter
func (*DelegatingReporter) Start ¶ added in v1.4.1
func (self *DelegatingReporter) Start(interval time.Duration)
func (*DelegatingReporter) VisitFloatMetric ¶ added in v1.4.1
func (self *DelegatingReporter) VisitFloatMetric(name string, val float64, extra string)
func (*DelegatingReporter) VisitGauge ¶ added in v1.4.1
func (self *DelegatingReporter) VisitGauge(name string, gauge Gauge)
func (*DelegatingReporter) VisitGaugeFloat64 ¶ added in v1.4.4
func (self *DelegatingReporter) VisitGaugeFloat64(name string, gauge GaugeFloat64)
func (*DelegatingReporter) VisitHistogram ¶ added in v1.4.1
func (self *DelegatingReporter) VisitHistogram(name string, metric Histogram)
func (*DelegatingReporter) VisitIntMetric ¶ added in v1.4.1
func (self *DelegatingReporter) VisitIntMetric(name string, val int64, extra string)
func (*DelegatingReporter) VisitMeter ¶ added in v1.4.1
func (self *DelegatingReporter) VisitMeter(name string, metric Meter)
func (*DelegatingReporter) VisitPercentileMetric ¶ added in v1.4.1
func (self *DelegatingReporter) VisitPercentileMetric(name string, val PercentileSource, extra string)
func (*DelegatingReporter) VisitTimer ¶ added in v1.4.1
func (self *DelegatingReporter) VisitTimer(name string, metric Timer)
type GaugeFloat64 ¶ added in v1.4.4
GaugeFloat64 represents a metric which holds a float64 value
type Handler ¶
type Handler interface {
// AcceptMetrics is called when new metrics become available
AcceptMetrics(message *metrics_pb.MetricsMessage)
}
Handler represents a sink for metric events
type Histogram ¶
type Histogram interface {
Metric
Count() int64
Max() int64
Mean() float64
Min() int64
Percentile(float64) float64
Percentiles([]float64) []float64
StdDev() float64
Sum() int64
Variance() float64
Clear()
Update(int64)
CreateSnapshot() Histogram
}
Histogram represents a metric which is measuring the distribution of values for some measurement
type IntervalCounter ¶
IntervalCounter allows tracking counters which are bucketized by some interval
type Meter ¶
type Meter interface {
Metric
Count() int64
Rate1() float64
Rate5() float64
Rate15() float64
RateMean() float64
Mark(int64)
}
Meter represents a metric which is measuring a count and a rate
type Metric ¶
type Metric interface {
Dispose()
}
Metric is the base functionality for all metrics types
type MetricSink ¶ added in v1.4.1
type PercentileSource ¶ added in v1.4.1
type Registry ¶
type Registry interface {
// SourceId returns the source id of this Registry
SourceId() string
// Gauge returns a Gauge for the given name. If one does not yet exist, one will be created
Gauge(name string) Gauge
// FuncGauge returns a Gauge for the given name. If one does not yet exist, one will be created using
// the given function
FuncGauge(name string, f func() int64) Gauge
// GaugeFloat64 returns a GaugeFloat64 for the given name. If one does not yet exist, one will be created
GaugeFloat64(name string) GaugeFloat64
// FuncGaugeFloat64 returns a GaugeFloat64 for the given name. If one does not yet exist, one will be created
// using the given function
FuncGaugeFloat64(name string, f func() float64) GaugeFloat64
// Meter returns a Meter for the given name. If one does not yet exist, one will be created
Meter(name string) Meter
// Histogram returns a Histogram for the given name. If one does not yet exist, one will be created
Histogram(name string) Histogram
// Timer returns a Timer for the given name. If one does not yet exist, one will be created
Timer(name string) Timer
// EachMetric calls the given visitor function for each Metric in this registry
EachMetric(visitor func(name string, metric Metric))
// GetGauge returns the Gauge for the given name or nil if a Gauge with that name doesn't exist
GetGauge(name string) Gauge
// GetGaugeFloat64 returns the GaugeFloat64 for the given name or nil if one doesn't exist
GetGaugeFloat64(name string) GaugeFloat64
// GetMeter returns the Meter for the given name or nil if a Meter with that name doesn't exist
GetMeter(name string) Meter
// GetHistogram returns the Histogram for the given name or nil if a Histogram with that name doesn't exist
GetHistogram(name string) Histogram
// GetTimer returns the Timer for the given name or nil if a Timer with that name doesn't exist
GetTimer(name string) Timer
// IsValidMetric returns true if a metric with the given name exists in the registry, false otherwise
IsValidMetric(name string) bool
// Poll returns a MetricsMessage with a snapshot of the metrics in the Registry
Poll() *metrics_pb.MetricsMessage
AcceptVisitor(visitor Visitor)
// DisposeAll removes and cleans up all metrics currently in the Registry
DisposeAll()
}
Registry allows for configuring and accessing metrics for an application
type Timer ¶
type Timer interface {
Metric
Count() int64
Max() int64
Mean() float64
Min() int64
Percentile(float64) float64
Percentiles([]float64) []float64
Rate1() float64
Rate5() float64
Rate15() float64
RateMean() float64
StdDev() float64
Sum() int64
Variance() float64
Time(func())
Update(time.Duration)
UpdateSince(time.Time)
CreateSnapshot() Timer
}
type UsageCounter ¶ added in v1.1.0
type UsageCounter interface {
Metric
Update(source UsageSource, usageType string, time time.Time, value uint64)
}
A UsageCounter allows tracking usage bucketized by some interval
type UsageRegistry ¶
type UsageRegistry interface {
Registry
PollWithoutUsageMetrics() *metrics_pb.MetricsMessage
IntervalCounter(name string, intervalSize time.Duration) IntervalCounter
UsageCounter(name string, intervalSize time.Duration) UsageCounter
FlushToHandler(handler Handler)
StartReporting(eventSink Handler, reportInterval time.Duration, msgQueueSize int)
}
UsageRegistry extends registry to allow collecting usage metrics
func NewUsageRegistry ¶
func NewUsageRegistry(config UsageRegistryConfig) UsageRegistry
type UsageRegistryConfig ¶ added in v1.3.0
type UsageRegistryConfig struct {
SourceId string
Tags map[string]string
EventQueueSize int
CloseNotify <-chan struct{}
IntervalAgeThreshold time.Duration
}
func DefaultUsageRegistryConfig ¶ added in v1.3.0
func DefaultUsageRegistryConfig(sourceId string, closeNotify <-chan struct{}) UsageRegistryConfig
type UsageSource ¶ added in v1.1.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.