Documentation ¶
Overview ¶
Package teststatsd provides a statsd client that maintains internal stats for unit testing various packages. It was pulled out of testutil to avoid a cyclic dependency with the `timing` package.
Index ¶
- type Client
- func (c *Client) Count(name string, value int64, tags []string, rate float64) error
- func (c *Client) Flush() error
- func (c *Client) Gauge(name string, value float64, tags []string, rate float64) error
- func (c *Client) GetCountSummaries() map[string]*CountSummary
- func (c *Client) GetGaugeSummaries() map[string]*GaugeSummary
- func (c *Client) Histogram(name string, value float64, tags []string, rate float64) error
- func (c *Client) Reset()
- func (c *Client) Timing(name string, value time.Duration, tags []string, rate float64) error
- type CountSummary
- type GaugeSummary
- type MetricsArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { statsd.NoOpClient GaugeErr error GaugeCalls []MetricsArgs CountErr error CountCalls []MetricsArgs HistogramErr error HistogramCalls []MetricsArgs TimingErr error TimingCalls []MetricsArgs // contains filtered or unexported fields }
Client is a mocked StatsClient that records all calls and replies with configurable error return values. Don't create this Client directly. Instead, use the constructor provided through `testutil.WithStatsClient`.
func (*Client) GetCountSummaries ¶
func (c *Client) GetCountSummaries() map[string]*CountSummary
GetCountSummaries computes summaries for all names supplied as parameters to Count calls.
func (*Client) GetGaugeSummaries ¶
func (c *Client) GetGaugeSummaries() map[string]*GaugeSummary
GetGaugeSummaries computes summaries for all names supplied as parameters to Gauge calls.
type CountSummary ¶
type CountSummary struct { Calls []MetricsArgs Sum int64 }
CountSummary contains a summary of all Count method calls to a particular StatsClient for a particular key.
type GaugeSummary ¶
type GaugeSummary struct { Calls []MetricsArgs Last float64 Max float64 }
GaugeSummary contains a summary of all Gauge method calls to a particular StatsClient for a particular key.