statsd: github.com/cyberdelia/statsd Index | Files

package statsd

import "github.com/cyberdelia/statsd"

Statsd client

Supports counting, sampling, timing, gauges, sets and multi-metrics packet.

Using the client to increment a counter:

client, err := statsd.Dial("127.0.0.1:8125")
if err != nil {
	// handle error
}
defer client.Close()
err = client.Increment("buckets", 1, 1)

Index

Package Files

statsd.go

type Client

type Client struct {
    // contains filtered or unexported fields
}

A statsd client representing a connection to a statsd server.

func Dial

func Dial(addr string) (*Client, error)

Dial connects to the given address on the given network using net.Dial and then returns a new Client for the connection.

func DialSize

func DialSize(addr string, size int) (*Client, error)

DialSize acts like Dial but takes a packet size. By default, the packet size is 512, see https://github.com/etsy/statsd/blob/master/docs/metric_types.md#multi-metric-packets for guidelines.

func DialTimeout

func DialTimeout(addr string, timeout time.Duration) (*Client, error)

DialTimeout acts like Dial but takes a timeout. The timeout includes name resolution, if required.

func (*Client) Close

func (c *Client) Close() error

Closes the connection.

func (*Client) Decrement

func (c *Client) Decrement(stat string, count int, rate float64) error

Decrement the counter for the given bucket.

func (*Client) DecrementGauge

func (c *Client) DecrementGauge(stat string, value int, rate float64) error

Decrement the value of the gauge.

func (*Client) Duration

func (c *Client) Duration(stat string, duration time.Duration, rate float64) error

Record time spent for the given bucket with time.Duration.

func (*Client) Flush

func (c *Client) Flush() error

Flush writes any buffered data to the network.

func (*Client) Gauge

func (c *Client) Gauge(stat string, value int, rate float64) error

Record arbitrary values for the given bucket.

func (*Client) Increment

func (c *Client) Increment(stat string, count int, rate float64) error

Increment the counter for the given bucket.

func (*Client) IncrementGauge

func (c *Client) IncrementGauge(stat string, value int, rate float64) error

Increment the value of the gauge.

func (*Client) Time

func (c *Client) Time(stat string, rate float64, f func()) error

Calculate time spent in given function and send it.

func (*Client) Timing

func (c *Client) Timing(stat string, delta int, rate float64) error

Record time spent for the given bucket in milliseconds.

func (*Client) Unique

func (c *Client) Unique(stat string, value int, rate float64) error

Record unique occurences of events.

Package statsd imports 6 packages (graph). Updated 2014-03-31. Refresh now. Tools for package owners.