Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetIntervalAgeThreshold ¶ added in v1.2.9
Types ¶
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 ¶
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 Metric ¶
type Metric interface {
Dispose()
}
Metric is the base functionality for all metrics types
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
// 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
// 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
// DisposeAll removes and cleans up all metrics currently in the Registry
DisposeAll()
}
Registry allows for configuring and accessing metrics for an application
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(sourceId string, tags map[string]string, closeNotify <-chan struct{}) UsageRegistry
type UsageSource ¶ added in v1.1.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.