Documentation
¶
Overview ¶
Package statsd implements a Statsd client. It supports all commands supported by the Etsy statsd server implementation and automatically buffers stats into 512 byte packets.
Index ¶
- func Count(bucket string, value float64, sampleRate float64)
- func CountUnique(bucket string, value string)
- func Flush()
- func Gauge(bucket string, value float64)
- func Join(parts ...string) (name string)
- func Setup(statsdURL string, packetSize int) (err error)
- func Timing(bucket string, value float64)
- func TimingDuration(bucket string, duration time.Duration)
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountUnique ¶
CountUnique sends a unique count metric using the global Statsd client.
func Join ¶
Join takes a slice of strings (a metric "path") and returns a valid Statsd metric name. It cleans all parts by slug-ifying them.
func TimingDuration ¶
TimingDuration sends a timing metric as a time.Duration using the global Statsd client.
Types ¶
type Client ¶
type Client interface {
Flush() error
Count(bucket string, value float64, sampleRate float64)
Gauge(bucket string, value float64)
Timing(bucket string, value float64)
TimingDuration(bucket string, duration time.Duration)
CountUnique(bucket string, value string)
}
Client is a buffered Statsd client.
func NewWithPacketSize ¶
NewWithPacketSize returns a new Client that will send stats to a Statsd server. If the given URL has a path component (eg. "/my.prefix"), all metric names will be prepended with that prefix.
The packet size parameter is the maximum size (in bytes) that will be buffered before being sent. A value of 0 or less will cause each stat to be sent immediately, as it is received.
If the Statsd URL is invalid, a no-op Client will be returned along with an error so that your code can ignore the error, if desired.