package metricstest
import "github.com/uber/jaeger-lib/metrics/metricstest"
Index ¶
- type Backend
- func NewBackend(collectionInterval time.Duration) *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 NewFactory(collectionInterval time.Duration) *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
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) Clear ¶
func (b *Backend) Clear()
Clear discards accumulated stats
func (*Backend) IncCounter ¶
IncCounter increments a counter value
func (*Backend) RecordHistogram ¶
RecordHistogram records a timing duration
func (*Backend) RecordTimer ¶
RecordTimer records a timing duration
func (*Backend) Snapshot ¶
Snapshot captures a snapshot of the current counter and gauge values
func (*Backend) Stop ¶
func (b *Backend) Stop()
Stop cleanly closes the background goroutine spawned by NewBackend.
func (*Backend) UpdateGauge ¶
UpdateGauge updates the value of a gauge
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) Counter ¶
Counter returns a local stats counter
func (*Factory) Gauge ¶
Gauge returns a local stats gauge.
func (*Factory) Histogram ¶
func (l *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram
Histogram returns a local stats histogram.
func (*Factory) Namespace ¶
Namespace returns a new namespace.
func (*Factory) Timer ¶
func (l *Factory) Timer(options metrics.TimerOptions) metrics.Timer
Timer returns a local stats timer.
Source Files ¶
- Version
- v2.4.1+incompatible (latest)
- Published
- Mar 29, 2021
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 6 hours ago –
Tools for package owners.