jaeger-lib: github.com/uber/jaeger-lib/metrics/metricstest Index | Files

package metricstest

import "github.com/uber/jaeger-lib/metrics/metricstest"

Index

Package Files

local.go metricstest.go

type Backend Uses

type Backend struct {
    TagsSep  string
    TagKVSep string
    // contains filtered or unexported fields
}

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 Uses

func NewBackend(collectionInterval time.Duration) *Backend

NewBackend returns a new Backend. The collectionInterval is the histogram time window for each timer.

func (*Backend) Clear Uses

func (b *Backend) Clear()

Clear discards accumulated stats

func (*Backend) IncCounter Uses

func (b *Backend) IncCounter(name string, tags map[string]string, delta int64)

IncCounter increments a counter value

func (*Backend) RecordHistogram Uses

func (b *Backend) RecordHistogram(name string, tags map[string]string, v float64)

RecordHistogram records a timing duration

func (*Backend) RecordTimer Uses

func (b *Backend) RecordTimer(name string, tags map[string]string, d time.Duration)

RecordTimer records a timing duration

func (*Backend) Snapshot Uses

func (b *Backend) Snapshot() (counters, gauges map[string]int64)

Snapshot captures a snapshot of the current counter and gauge values

func (*Backend) Stop Uses

func (b *Backend) Stop()

Stop cleanly closes the background goroutine spawned by NewBackend.

func (*Backend) UpdateGauge Uses

func (b *Backend) UpdateGauge(name string, tags map[string]string, value int64)

UpdateGauge updates the value of a gauge

type ExpectedMetric Uses

type ExpectedMetric struct {
    Name  string
    Tags  map[string]string
    Value int
}

ExpectedMetric contains metrics under test.

type Factory Uses

type Factory struct {
    *Backend
    // contains filtered or unexported fields
}

Factory stats factory that creates metrics that are stored locally

func NewFactory Uses

func NewFactory(collectionInterval time.Duration) *Factory

NewFactory returns a new LocalMetricsFactory

func (*Factory) AssertCounterMetrics Uses

func (f *Factory) AssertCounterMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)

AssertCounterMetrics checks if counter metrics exist.

func (*Factory) AssertGaugeMetrics Uses

func (f *Factory) AssertGaugeMetrics(t *testing.T, expectedMetrics ...ExpectedMetric)

AssertGaugeMetrics checks if gauge metrics exist.

func (*Factory) Counter Uses

func (l *Factory) Counter(options metrics.Options) metrics.Counter

Counter returns a local stats counter

func (*Factory) Gauge Uses

func (l *Factory) Gauge(options metrics.Options) metrics.Gauge

Gauge returns a local stats gauge.

func (*Factory) Histogram Uses

func (l *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram

Histogram returns a local stats histogram.

func (*Factory) Namespace Uses

func (l *Factory) Namespace(scope metrics.NSOptions) metrics.Factory

Namespace returns a new namespace.

func (*Factory) Timer Uses

func (l *Factory) Timer(options metrics.TimerOptions) metrics.Timer

Timer returns a local stats timer.

Package metricstest imports 7 packages (graph) and is imported by 2 packages. Updated 2019-03-27. Refresh now. Tools for package owners.