-- import "github.com/statsd/datadog"
Package datadog implements a simple dogstatsd client
c, err := Dial(":5000")
c.SetPrefix("myprogram")
c.SetTags("env:stage", "program:myprogram")
c.Incr("count")
type Client struct {
sync.Mutex
}
Client represents a datadog client.
func Dial(addr string) (*Client, error)
Dial connects to addr
and returns a client.
func DialSize(addr string, size int) (*Client, error)
DialSize connects with the given buffer size
. see https://git.io/vzC0D.
func New(w io.Writer) *Client
New returns a new Client with writer w
, useful for testing.
func (c *Client) Close() error
Close will flush and close the connection.
func (c *Client) Decr(name string, tags ...string) error
Decr decrements counter name
with tags
.
func (c *Client) DecrBy(name string, n int, tags ...string) error
DecrBy decrements counter name
by n
with optional tags
.
func (c *Client) Duration(name string, d time.Duration, tags ...string) error
Duration uses Histogram()
to send the given d
duration.
func (c *Client) Flush() error
Flush will flush the underlying buffer.
func (c *Client) Gauge(name string, n int, tags ...string) error
Gauge sets the metric name
to n
at a given time.
func (c *Client) Histogram(name string, v int, tags ...string) error
Histogram measures the statistical distribution of a metric name
with the
given v
value, rate
and tags
.
func (c *Client) Incr(name string, tags ...string) error
Incr increments counter name
with tags
.
func (c *Client) IncrBy(name string, n int, tags ...string) error
IncrBy increments counter name
by n
with optional tags
.
func (c *Client) Increment(name string, count int, rate float64, tags ...string) error
Increment incremenets the given stat name
with the given count
, rate
and
tags...
.
func (c *Client) SetPrefix(name string)
SetPrefix sets global prefix name
.
func (c *Client) SetTags(tags ...string)
SetTags sets global tags tags...
.
func (c *Client) Unique(name, value string, tags ...string) error
Unique records a unique occurence of events.