Documentation ¶
Overview ¶
Package statsd implements the metrics interface with StatsD.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) IncErrorCounter(task, operation, code string)
- func (c *Client) IncLogLevelCounter(level string)
- func (c *Client) InstrumentDB(_ string, _ *sql.DB) error
- func (c *Client) InstrumentHandler(path string, handler http.HandlerFunc) http.Handler
- func (c *Client) InstrumentRoundTripper(next http.RoundTripper) http.RoundTripper
- func (c *Client) MetricsHandlerFunc() http.HandlerFunc
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the state type of this client.
func (*Client) IncErrorCounter ¶
IncErrorCounter increments the number of errors by task, operation and error code.
func (*Client) IncLogLevelCounter ¶
IncLogLevelCounter counts the number of errors for each log severity level.
func (*Client) InstrumentDB ¶
InstrumentDB wraps a sql.DB to collect metrics - [NOT IMPLEMENTED].
func (*Client) InstrumentHandler ¶
InstrumentHandler wraps an http.Handler to collect StatsD metrics.
func (*Client) InstrumentRoundTripper ¶
func (c *Client) InstrumentRoundTripper(next http.RoundTripper) http.RoundTripper
InstrumentRoundTripper is a middleware that wraps the provided http.RoundTripper to observe the request result with default metrics.
func (*Client) MetricsHandlerFunc ¶
func (c *Client) MetricsHandlerFunc() http.HandlerFunc
MetricsHandlerFunc returns an http handler function to serve the metrics endpoint. This is not used for the StatsD implementation as the metrics are directly sent to the StatsD server.
type Option ¶
type Option func(c *Client)
Option is the interface that allows to set client options.
func WithAddress ¶
WithAddress sets the network address of the StatsD daemon (ip:port) or just (:port).
func WithFlushPeriod ¶
WithFlushPeriod sets how often the StatsD client's buffer is flushed.
func WithNetwork ¶
WithNetwork sets the network type used by the StatsD client (i.e. udp or tcp).
func WithPrefix ¶
WithPrefix sets the StatsD client's string prefix that will be used in every bucket name.