Documentation ¶
Overview ¶
Package testmetrics is for testing provider metrics with a test Provider that adheres to the Provider interface
Index ¶
- type CardinalityCounter
- type Counter
- type Gauge
- type Histogram
- type Provider
- func (p *Provider) CheckCardinalityCounter(name string, estimate uint64, labelValues ...string)
- func (p *Provider) CheckCounter(name string, v float64, labelValues ...string)
- func (p *Provider) CheckCounterExists(name string, labelValues ...string)
- func (p *Provider) CheckGauge(name string, v float64, labelValues ...string)
- func (p *Provider) CheckGaugeNonZero(name string, labelValues ...string)
- func (p *Provider) CheckNoCounter(name string, labelValues ...string)
- func (p *Provider) CheckNoGauge(name string, labelValues ...string)
- func (p *Provider) CheckObservationCount(name string, n int, labelValues ...string)
- func (p *Provider) CheckObservations(name string, obs []float64, labelValues ...string)
- func (p *Provider) CheckObservationsMatch(name string, obs []float64, labelValues ...string)
- func (p *Provider) CheckObservationsMinMax(name string, min, max float64, labelValues ...string)
- func (p *Provider) CheckStopped()
- func (p *Provider) Flush() error
- func (p *Provider) NewCardinalityCounter(name string) xmetrics.CardinalityCounter
- func (p *Provider) NewCounter(name string) metrics.Counter
- func (p *Provider) NewExplicitHistogram(name string, _ xmetrics.DistributionFunc) metrics.Histogram
- func (p *Provider) NewGauge(name string) metrics.Gauge
- func (p *Provider) NewHistogram(name string, _ int) metrics.Histogram
- func (p *Provider) PrintCounterValue(name string)
- func (p *Provider) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CardinalityCounter ¶ added in v0.0.62
type CardinalityCounter struct { Name string sync.RWMutex // contains filtered or unexported fields }
CardinalityCounter provides a wrapper around a HyperLogLog probabalistic counter. It implements CardinalityCounter Interface.
func (*CardinalityCounter) Estimate ¶ added in v0.0.62
func (c *CardinalityCounter) Estimate() uint64
func (*CardinalityCounter) Insert ¶ added in v0.0.62
func (c *CardinalityCounter) Insert(i []byte)
Insert adds the item to the set to be counted.
func (*CardinalityCounter) With ¶ added in v0.0.62
func (c *CardinalityCounter) With(labelValues ...string) xmetrics.CardinalityCounter
With implements xmetrics.CardinalityCounter interface. It returns a CardinalityCounter based on the labelValues.
type Counter ¶
Counter accumulates a value based on Add calls.
type Histogram ¶
Histogram collects observations without computing quantiles so the observations can be checked by tests.
type Provider ¶
Provider collects registered metrics for testing.
func NewProvider ¶
NewProvider constructs a test provider which can later be checked.
func (*Provider) CheckCardinalityCounter ¶
CheckCardinalityCounter checks that there is a registered cardinality counter with the name and estimate provided.
func (*Provider) CheckCounter ¶
CheckCounter checks that there is a registered counter with the name and value provided.
func (*Provider) CheckCounterExists ¶ added in v0.2.7
CheckCounterExists checks that there is registered counter with the name provided and value is not 0.
func (*Provider) CheckGauge ¶
CheckGauge checks that there is a registered gauge with the name and value provided.
func (*Provider) CheckGaugeNonZero ¶
CheckGaugeNonZero checks that there is a registered gauge with the name provided whose value is != 0.
func (*Provider) CheckNoCounter ¶
CheckNoCounter checks that there is no registered counter with the name provided.
func (*Provider) CheckNoGauge ¶
CheckNoGauge checks that there is no registered gauge with the name provided.
func (*Provider) CheckObservationCount ¶
CheckObservationCount checks that there is a histogram with the name and number of observations provided.
func (*Provider) CheckObservations ¶
CheckObservations checks that there is a histogram with the name and observations provided.
func (*Provider) CheckObservationsMatch ¶
CheckObservationsMatch checks that there is a histogram with the name and observations provided, ignoring order.
func (*Provider) CheckObservationsMinMax ¶
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 ¶
NewCounter implements go-kit's Provider interface.
func (*Provider) NewExplicitHistogram ¶ added in v0.0.48
NewExplicitHistogram implements go-kit's Provider interface.
func (*Provider) NewHistogram ¶
NewHistogram implements go-kit's Provider interface.
func (*Provider) PrintCounterValue ¶ added in v0.0.10
PrintCounterValue prints the value of the specified counter and their current counts