testmetrics

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Counter accumulates a value based on Add calls.

func (*Counter) Add

func (c *Counter) Add(delta float64)

Add implements the metrics.Counter interface.

func (*Counter) With

func (c *Counter) With(labelValues ...string) metrics.Counter

With implements the metrics.Counter interface.

type Gauge

type Gauge struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Gauge stores a value based on Add/Set calls.

func (*Gauge) Add

func (g *Gauge) Add(delta float64)

Add implements the metrics.Gauge interface.

func (*Gauge) Set

func (g *Gauge) Set(v float64)

Set implements the metrics.Gauge interface.

func (*Gauge) With

func (g *Gauge) With(labelValues ...string) metrics.Gauge

With implements the metrics.Gauge interface.

type Histogram

type Histogram struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Histogram collects observations without computing quantiles so the observations can be checked by tests.

func (*Histogram) Observe

func (h *Histogram) Observe(v float64)

Observe implements the metrics.Histogram interface.

func (*Histogram) With

func (h *Histogram) With(labelValues ...string) metrics.Histogram

With implements the metrics.Histogram interface.

type Provider

type Provider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Provider collects registered metrics for testing.

func NewProvider

func NewProvider(t *testing.T) *Provider

NewProvider constructs a test provider which can later be checked.

func (*Provider) CheckCardinalityCounter

func (p *Provider) CheckCardinalityCounter(name string, estimate uint64)

CheckCardinalityCounter checks that there is a registered cardinality counter with the name and estimate provided.

func (*Provider) CheckCounter

func (p *Provider) CheckCounter(name string, v float64, labelValues ...string)

CheckCounter checks that there is a registered counter with the name and value provided.

func (*Provider) CheckGauge

func (p *Provider) CheckGauge(name string, v float64, labelValues ...string)

CheckGauge checks that there is a registered gauge with the name and value provided.

func (*Provider) CheckGaugeNonZero

func (p *Provider) CheckGaugeNonZero(name string, labelValues ...string)

CheckGaugeNonZero checks that there is a registered gauge with the name provided whose value is != 0.

func (*Provider) CheckNoCounter

func (p *Provider) CheckNoCounter(name string, labelValues ...string)

CheckNoCounter checks that there is no registered counter with the name provided.

func (*Provider) CheckNoGauge

func (p *Provider) CheckNoGauge(name string, labelValues ...string)

CheckNoGauge checks that there is no registered gauge with the name provided.

func (*Provider) CheckObservationCount

func (p *Provider) CheckObservationCount(name string, n int, labelValues ...string)

CheckObservationCount checks that there is a histogram with the name and number of observations provided.

func (*Provider) CheckObservations

func (p *Provider) CheckObservations(name string, obs []float64, labelValues ...string)

CheckObservations checks that there is a histogram with the name and observations provided.

func (*Provider) CheckObservationsMatch

func (p *Provider) CheckObservationsMatch(name string, obs []float64, labelValues ...string)

CheckObservationsMatch checks that there is a histogram with the name and observations provided, ignoring order.

func (*Provider) CheckObservationsMinMax

func (p *Provider) CheckObservationsMinMax(name string, min, max float64, labelValues ...string)

CheckObservationsMinMax checks that there is a histogram with the name and that the values all fall within the min/max range.

func (*Provider) CheckStopped

func (p *Provider) CheckStopped()

CheckStopped verifies that a provider has been Stop'd.

func (*Provider) NewCardinalityCounter

func (p *Provider) NewCardinalityCounter(name string) xmetrics.CardinalityCounter

NewCardinalityCounter implements metrics.Provider.

func (*Provider) NewCounter

func (p *Provider) NewCounter(name string) metrics.Counter

NewCounter implements go-kit's Provider interface.

func (*Provider) NewGauge

func (p *Provider) NewGauge(name string) metrics.Gauge

NewGauge implements go-kit's Provider interface.

func (*Provider) NewHistogram

func (p *Provider) NewHistogram(name string, _ int) metrics.Histogram

NewHistogram implements go-kit's Provider interface.

func (*Provider) Stop

func (p *Provider) Stop()

Stop makes it Provider compliant.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL