Documentation ¶
Index ¶
- Constants
- func ListenAndServe(addr string, handler Handler) (err error)
- func Serve(conn net.PacketConn, handler Handler) (err error)
- type Client
- type ClientConfig
- type Conn
- func (c *Conn) Close() (err error)
- func (c *Conn) Flush() (err error)
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type ConnConfig
- type Handler
- type HandlerFunc
- type Metric
- type MetricType
Constants ¶
const ( // MaxBufferSize is a hard-limit on the max size of the datagram buffer. MaxBufferSize = 65507 // DefaultAddress is the default address to which clients connection to. DefaultAddress = "localhost:8125" // DefaultBufferSize is the default size of the client buffer. DefaultBufferSize = 1024 // DefaultFlushInterval is the default interval at which clients flush // metrics from their stats engine. DefaultFlushInterval = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
ListenAndServe starts a new dogstatsd server, listening for UDP datagrams on addr and forwarding the metrics to handler.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a datadog client that pulls metrics from a stats engine and forward them to a dogstatsd agent.
func NewClient ¶
NewClient creates and returns a new datadog client publishing metrics to the dogstatsd server listening for UDP datagram at addr.
func NewClientWith ¶
func NewClientWith(config ClientConfig) *Client
NewClientWith creates and returns a new datadog client configured with config.
func (*Client) HandleMetric ¶
HandleMetric satisfies the stats.Handler interface.
type ClientConfig ¶
type ClientConfig struct { // Address of the dogstatsd agent to send metrics to. Address string // BufferSize is the size of the output buffer used by the client. BufferSize int }
The ClientConfig type is used to configure datadog clients.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn represents a UDP connection to a dogstatsd server.
func DialConfig ¶
func DialConfig(config ConnConfig) (conn *Conn, err error)
DialConfig opens a new dogstatsd connection using config.
func (*Conn) RemoteAddr ¶
RemoteAddr satisfies the net.Conn interface.
func (*Conn) SetDeadline ¶
SetDeadline satisfies the net.Conn interface.
func (*Conn) SetReadDeadline ¶
SetReadDeadline satisfies the net.Conn interface.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline satisfies the net.Conn interface.
type ConnConfig ¶
ConnConfig carries the configuration options that can be set when creating a connection.
type Handler ¶
type Handler interface { // HandleMetric is called when a dogstatsd server receives a metric. // The method receives the metric and the address from which it was sent. HandleMetric(Metric, net.Addr) }
Handler defines the interface that types must satisfy to process metrics received by a dogstatsd server.
type HandlerFunc ¶
HandlerFunc makes it possible for function types to be used as metric handlers on dogstatsd servers.
func (HandlerFunc) HandleMetric ¶
func (f HandlerFunc) HandleMetric(m Metric, a net.Addr)
HandleMetric calls f(m, a).
type Metric ¶
type Metric struct { Type MetricType // the metric type Namespace string // the metric namespace (never populated by parsing operations) Name string // the metric name Value float64 // the metric value Rate float64 // sample rate, a value between 0 and 1 Tags []stats.Tag // the list of tags set on the metric }
The Metric type is a representation of the metrics supported by datadog.
type MetricType ¶
type MetricType string
MetricType is an enumeration providing symbols to represent the different metric types upported by datadog.
const ( Counter MetricType = "c" Gauge MetricType = "g" Histogram MetricType = "h" Unknown MetricType = "?" )