Documentation ¶
Index ¶
- type Backend
- func (b *Backend) Clear()
- func (b *Backend) IncCounter(name string, tags map[string]string, delta int64)
- func (b *Backend) RecordHistogram(name string, tags map[string]string, v float64)
- func (b *Backend) RecordTimer(name string, tags map[string]string, d time.Duration)
- func (b *Backend) Snapshot() (counters, gauges map[string]int64)
- func (b *Backend) Stop()
- func (b *Backend) UpdateGauge(name string, tags map[string]string, value int64)
- type ExpectedMetric
- type Factory
- func (f *Factory) AssertCounterMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)
- func (f *Factory) AssertGaugeMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)
- func (l *Factory) Counter(options metrics.Options) metrics.Counter
- func (l *Factory) Gauge(options metrics.Options) metrics.Gauge
- func (l *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram
- func (l *Factory) Namespace(scope metrics.NSOptions) metrics.Factory
- func (l *Factory) Timer(options metrics.TimerOptions) metrics.Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
A Backend is a metrics provider which aggregates data in-vm, and allows exporting snapshots to shove the data into a remote collector
func NewBackend ¶
NewBackend returns a new Backend. The collectionInterval is the histogram time window for each timer.
func (*Backend) IncCounter ¶
IncCounter increments a counter value
func (*Backend) RecordHistogram ¶
RecordHistogram records a timing duration
func (*Backend) RecordTimer ¶
RecordTimer records a timing duration
type ExpectedMetric ¶
ExpectedMetric contains metrics under test.
type Factory ¶
type Factory struct { *Backend // contains filtered or unexported fields }
Factory stats factory that creates metrics that are stored locally
func NewFactory ¶
NewFactory returns a new LocalMetricsFactory
func (*Factory) AssertCounterMetrics ¶
func (f *Factory) AssertCounterMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)
AssertCounterMetrics checks if counter metrics exist.
func (*Factory) AssertGaugeMetrics ¶
func (f *Factory) AssertGaugeMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)
AssertGaugeMetrics checks if gauge metrics exist.
func (*Factory) Histogram ¶
func (l *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram
Histogram returns a local stats histogram.