statsd

package module
v0.0.0-...-d14e546 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2013 License: MIT Imports: 6 Imported by: 2

README

statsd

statsd is a client library for statsd written in Go.

Installation

Download and install :

$ go get github.com/cyberdelia/statsd

Add it to your code :

import "github.com/cyberdelia/statsd"

Use

c := statsd.Dial("localhost:8125")
c.Increment("incr", 1, 1)
c.Decrement("decr", 1, 0.1)
c.Timing("timer", 320, 0.1)
c.Time("timer", 0.1, func() {
        // do something  
})
c.Gauge("gauge", 30, 1)
c.Unique("unique", 765, 1)

Documentation

Overview

Client library for statsd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex
	// 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 DialTimeout

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) Decrement

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

Decrement the counter for the given bucket

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

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) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL