Documentation ¶
Index ¶
- Constants
- Variables
- func Count(id CounterMetric) bool
- func CountIf(id CounterMetric, condition bool) bool
- func CountN(id CounterMetric, increment int64) bool
- func InitializeEnvironmentTags(tags string)
- func InitializeTags(tags string, reader func(string) string)
- func Measure(id GaugeMetric, value int64) bool
- func Microseconds(duration time.Duration) int64
- func Milliseconds(duration time.Duration) int64
- func RawCount(id CounterMetric, value int64) bool
- func Record(id HistogramMetric, value int64) bool
- func StartAppOptics(key string, queueCapacity, writers int) error
- func StartAppOpticsConfig(configLoader AppOpticsConfigLoader, queueCapacity, writers int) error
- func StartMeasuring()
- func StopMeasuring()
- func TagAll(tagPairs ...string)
- func TagCounter(id CounterMetric, tagPairs ...string)
- func TagGauge(id GaugeMetric, tagPairs ...string)
- func TagHistogram(id HistogramMetric, tagPairs ...string)
- type AppOptics
- type AppOpticsConfig
- type AppOpticsConfigLoader
- type AtomicMetric
- type CounterMetric
- type GaugeMetric
- type Histogram
- type HistogramMaxMetric
- type HistogramMeanMetric
- type HistogramMetric
- type HistogramMinMetric
- type HistogramQuantileMetric
- type HistogramStandardDeviationMetric
- type HistogramTotalCountMetric
- type ListenCloser
- type Measurement
- type Measurements
- type Metric
- type MetricMeasurement
- type Metrics
- func (this *Metrics) Count(id CounterMetric) bool
- func (this *Metrics) CountIf(id CounterMetric, condition bool) bool
- func (this *Metrics) CountN(id CounterMetric, increment int64) bool
- func (this *Metrics) CounterValue(id CounterMetric) int64
- func (this *Metrics) GaugeValue(id GaugeMetric) int64
- func (this *Metrics) HistogramValue(id HistogramMetric) Histogram
- func (this *Metrics) Measure(id GaugeMetric, value int64) bool
- func (this *Metrics) RawCount(id CounterMetric, value int64) bool
- func (this *Metrics) Record(id HistogramMetric, value int64) bool
- type MetricsTracker
- func (this *MetricsTracker) AddCounter(name string, update time.Duration) CounterMetric
- func (this *MetricsTracker) AddGauge(name string, update time.Duration) GaugeMetric
- func (this *MetricsTracker) AddHistogram(name string, update time.Duration, min, max int64, resolution int, ...) HistogramMetric
- func (this *MetricsTracker) Count(id CounterMetric) bool
- func (this *MetricsTracker) CountN(id CounterMetric, n int64) bool
- func (this *MetricsTracker) Measure(id GaugeMetric, value int64) bool
- func (this *MetricsTracker) RawCount(id CounterMetric, value int64) bool
- func (this *MetricsTracker) Record(id HistogramMetric, value int64) bool
- func (this *MetricsTracker) StartMeasuring()
- func (this *MetricsTracker) StopMeasuring()
- func (this *MetricsTracker) TagAll(tagPairs ...string)
- func (this *MetricsTracker) TagCounter(metric CounterMetric, tagPairs ...string)
- func (this *MetricsTracker) TagGauge(metric GaugeMetric, tagPairs ...string)
- func (this *MetricsTracker) TagHistogram(metric HistogramMetric, tagPairs ...string)
- func (this *MetricsTracker) TakeMeasurements(now time.Time) (measurements []MetricMeasurement)
- type ReportingFrequency
- type SynchronizedHistogram
- func (this *SynchronizedHistogram) Max() int64
- func (this *SynchronizedHistogram) Mean() float64
- func (this *SynchronizedHistogram) Min() int64
- func (this *SynchronizedHistogram) RecordValue(v int64) error
- func (this *SynchronizedHistogram) StdDev() float64
- func (this *SynchronizedHistogram) TotalCount() int64
- func (this *SynchronizedHistogram) ValueAtQuantile(q float64) int64
Constants ¶
const MetricConflict = -1
Variables ¶
var Options singleton
Functions ¶
func Count ¶
func Count(id CounterMetric) bool
Count increments the metric indicated by id. A return value of false indicates the count could not occur.
func CountIf ¶
func CountIf(id CounterMetric, condition bool) bool
CountIf increments the metric indicated by id if the supplied condition is true. A return value of false indicates that the count could not occur or the supplied condition was false.
func CountN ¶
func CountN(id CounterMetric, increment int64) bool
Count increments the metric indicated by the number provided. A return value of false indicates the count could not occur.
func InitializeEnvironmentTags ¶
func InitializeEnvironmentTags(tags string)
func InitializeTags ¶
func Measure ¶
func Measure(id GaugeMetric, value int64) bool
Measure sets the metric indicated to the value specified. A return value of false indicates the count could not occur.
func Microseconds ¶
Microseconds converts the duration value to microseconds, a commonly used unit of measurement for latency metrics. This return value could easily be used as a gauge or histogram measurement.
func Milliseconds ¶
Milliseconds converts the duration value to milliseconds, a possible unit of measurement for latency metrics. This return value could easily be used as a gauge or histogram measurement.
func RawCount ¶
func RawCount(id CounterMetric, value int64) bool
RawCount is similar to Measure, except that the backend is still a counter but the application is now responsible for tracking the count rather than the metric itself tracking it. A return value of false indicates the count could not occur.
func Record ¶
func Record(id HistogramMetric, value int64) bool
Record records the value with the histogram indicated. A return value of false indicates the count could not occur.
func StartAppOptics ¶
StartAppOptics configures a new metrics instance, specifies a number of AppOptics writers, and starts measuring.
func StartAppOpticsConfig ¶
func StartAppOpticsConfig(configLoader AppOpticsConfigLoader, queueCapacity, writers int) error
StartAppOpticsConfig uses the provided configLoader to configure a new metrics instance, specify a number of AppOptics writers, and start measuring.
func StartMeasuring ¶
func StartMeasuring()
StartMeasuring signals to this library that all registrations have been performed.
func StopMeasuring ¶
func StopMeasuring()
StopMeasuring turns measurement tracking off. It can be turned on again by calling StartMeasuring.
func TagCounter ¶
func TagCounter(id CounterMetric, tagPairs ...string)
TagCounter associates key/value string pairs with the provided metric id.
func TagGauge ¶
func TagGauge(id GaugeMetric, tagPairs ...string)
TagGauge associates key/value string pairs with the provided metric id.
func TagHistogram ¶
func TagHistogram(id HistogramMetric, tagPairs ...string)
TagHistogram associates key/value string pairs with the provided metric id.
Types ¶
type AppOptics ¶
type AppOptics struct {
// contains filtered or unexported fields
}
func (*AppOptics) Listen ¶
func (this *AppOptics) Listen(queue chan []MetricMeasurement)
type AppOpticsConfig ¶
type AppOpticsConfig struct {
Key string
}
type AppOpticsConfigLoader ¶
type AppOpticsConfigLoader func() AppOpticsConfig
type AtomicMetric ¶
type AtomicMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewAtomicMetric ¶
func NewAtomicMetric(name string, update time.Duration, metricType int) *AtomicMetric
func NewCounter ¶
func NewCounter(name string, update time.Duration) *AtomicMetric
func (*AtomicMetric) Add ¶
func (this *AtomicMetric) Add(delta int64)
func (*AtomicMetric) Measure ¶
func (this *AtomicMetric) Measure() MetricMeasurement
func (*AtomicMetric) Set ¶
func (this *AtomicMetric) Set(value int64)
type CounterMetric ¶
type CounterMetric int
func AddCounter ¶
func AddCounter(name string, reportingFrequency time.Duration) CounterMetric
AddCounter registers a named counter metric along with the desired reporting frequency. The function is meant to be called *only* at application startup and is not thread safe. A negative return value indicates that the registration was unsuccessful.
type GaugeMetric ¶
type GaugeMetric int
func AddGauge ¶
func AddGauge(name string, reportingFrequency time.Duration) GaugeMetric
AddGauge registers a named gauge metric along with the desired reporting frequency. The function is meant to be called *only* at application startup and is not thread safe. A negative return value indicates that the registration was unsuccessful.
type HistogramMaxMetric ¶
type HistogramMaxMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewHistogramMaxMetric ¶
func NewHistogramMaxMetric(basename string, histogram Histogram, update time.Duration) *HistogramMaxMetric
func (*HistogramMaxMetric) Measure ¶
func (this *HistogramMaxMetric) Measure() MetricMeasurement
type HistogramMeanMetric ¶
type HistogramMeanMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewHistogramMeanMetric ¶
func NewHistogramMeanMetric(basename string, histogram Histogram, update time.Duration) *HistogramMeanMetric
func (*HistogramMeanMetric) Measure ¶
func (this *HistogramMeanMetric) Measure() MetricMeasurement
type HistogramMetric ¶
type HistogramMetric int
func AddHistogram ¶
func AddHistogram( name string, reportingFrequency time.Duration, min, max int64, resolution int, quantiles ...float64) HistogramMetric
AddHistogram registers a named histogram metric along with the desired reporting frequency. The function is meant to be called *only* at application startup and is not thread safe. A negative return value indicates that the registration was unsuccessful.
type HistogramMinMetric ¶
type HistogramMinMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewHistogramMinMetric ¶
func NewHistogramMinMetric(basename string, histogram Histogram, update time.Duration) *HistogramMinMetric
func (*HistogramMinMetric) Measure ¶
func (this *HistogramMinMetric) Measure() MetricMeasurement
type HistogramQuantileMetric ¶
type HistogramQuantileMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func (*HistogramQuantileMetric) Measure ¶
func (this *HistogramQuantileMetric) Measure() MetricMeasurement
type HistogramStandardDeviationMetric ¶
type HistogramStandardDeviationMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewHistogramStandardDeviationMetric ¶
func NewHistogramStandardDeviationMetric( basename string, histogram Histogram, update time.Duration) *HistogramStandardDeviationMetric
func (*HistogramStandardDeviationMetric) Measure ¶
func (this *HistogramStandardDeviationMetric) Measure() MetricMeasurement
type HistogramTotalCountMetric ¶
type HistogramTotalCountMetric struct { *ReportingFrequency // contains filtered or unexported fields }
func NewHistogramTotalCountMetric ¶
func NewHistogramTotalCountMetric( basename string, histogram Histogram, update time.Duration) *HistogramTotalCountMetric
func (*HistogramTotalCountMetric) Measure ¶
func (this *HistogramTotalCountMetric) Measure() MetricMeasurement
type ListenCloser ¶ added in v1.3.1
func NewListener ¶ added in v1.3.1
func NewListener(key string, options ...option) ListenCloser
type Measurement ¶
type Measurements ¶
type Measurements struct {
Measurements []Measurement `json:"measurements"`
}
type MetricMeasurement ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics can be used as a struct field and overridden with the Capture function in unit test setups to allow assertions on counted and measured values. This approach is similar to the one employed by the clock package (see github.com/smartystreets/clock).
func (*Metrics) Count ¶
func (this *Metrics) Count(id CounterMetric) bool
func (*Metrics) CounterValue ¶
func (this *Metrics) CounterValue(id CounterMetric) int64
Helper functions for test assertions:
func (*Metrics) GaugeValue ¶
func (this *Metrics) GaugeValue(id GaugeMetric) int64
func (*Metrics) HistogramValue ¶
func (this *Metrics) HistogramValue(id HistogramMetric) Histogram
type MetricsTracker ¶
type MetricsTracker struct {
// contains filtered or unexported fields
}
func New ¶
func New() *MetricsTracker
func (*MetricsTracker) AddCounter ¶
func (this *MetricsTracker) AddCounter(name string, update time.Duration) CounterMetric
func (*MetricsTracker) AddGauge ¶
func (this *MetricsTracker) AddGauge(name string, update time.Duration) GaugeMetric
func (*MetricsTracker) AddHistogram ¶
func (this *MetricsTracker) AddHistogram( name string, update time.Duration, min, max int64, resolution int, quantiles ...float64, ) HistogramMetric
func (*MetricsTracker) Count ¶
func (this *MetricsTracker) Count(id CounterMetric) bool
func (*MetricsTracker) CountN ¶
func (this *MetricsTracker) CountN(id CounterMetric, n int64) bool
func (*MetricsTracker) Measure ¶
func (this *MetricsTracker) Measure(id GaugeMetric, value int64) bool
func (*MetricsTracker) RawCount ¶
func (this *MetricsTracker) RawCount(id CounterMetric, value int64) bool
func (*MetricsTracker) Record ¶
func (this *MetricsTracker) Record(id HistogramMetric, value int64) bool
func (*MetricsTracker) StartMeasuring ¶
func (this *MetricsTracker) StartMeasuring()
func (*MetricsTracker) StopMeasuring ¶
func (this *MetricsTracker) StopMeasuring()
func (*MetricsTracker) TagAll ¶
func (this *MetricsTracker) TagAll(tagPairs ...string)
func (*MetricsTracker) TagCounter ¶
func (this *MetricsTracker) TagCounter(metric CounterMetric, tagPairs ...string)
func (*MetricsTracker) TagGauge ¶
func (this *MetricsTracker) TagGauge(metric GaugeMetric, tagPairs ...string)
func (*MetricsTracker) TagHistogram ¶
func (this *MetricsTracker) TagHistogram(metric HistogramMetric, tagPairs ...string)
func (*MetricsTracker) TakeMeasurements ¶
func (this *MetricsTracker) TakeMeasurements(now time.Time) (measurements []MetricMeasurement)
type ReportingFrequency ¶
type ReportingFrequency struct {
// contains filtered or unexported fields
}
func (*ReportingFrequency) MeasurementIsOverdue ¶
func (this *ReportingFrequency) MeasurementIsOverdue(now time.Time) (overdue bool)
func (*ReportingFrequency) ScheduleNextMeasurement ¶
func (this *ReportingFrequency) ScheduleNextMeasurement(now time.Time)
type SynchronizedHistogram ¶
type SynchronizedHistogram struct {
// contains filtered or unexported fields
}
func NewSynchronizedHistogram ¶
func NewSynchronizedHistogram(inner Histogram, readLock, writeLock sync.Locker) *SynchronizedHistogram
func (*SynchronizedHistogram) Max ¶
func (this *SynchronizedHistogram) Max() int64
func (*SynchronizedHistogram) Mean ¶
func (this *SynchronizedHistogram) Mean() float64
func (*SynchronizedHistogram) Min ¶
func (this *SynchronizedHistogram) Min() int64
func (*SynchronizedHistogram) RecordValue ¶
func (this *SynchronizedHistogram) RecordValue(v int64) error
func (*SynchronizedHistogram) StdDev ¶
func (this *SynchronizedHistogram) StdDev() float64
func (*SynchronizedHistogram) TotalCount ¶
func (this *SynchronizedHistogram) TotalCount() int64
func (*SynchronizedHistogram) ValueAtQuantile ¶
func (this *SynchronizedHistogram) ValueAtQuantile(q float64) int64
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
hdrhistogram
Package hdrhistogram provides an implementation of Gil Tene's HDR Histogram data structure.
|
Package hdrhistogram provides an implementation of Gil Tene's HDR Histogram data structure. |