statsd

package
v0.0.0-...-c2832fb Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMetricsAddr = ":8125"

DefaultMetricsAddr is the default address on which a MetricReceiver will listen

View Source
const MaxPacket = 8096

How big to make the receive buffer. This default size is enough for a jumbo ethernet frame and the largest UDP packet possible.

Variables

View Source
var ErrInvalidFormat = errors.New("invalid format")

Functions

This section is empty.

Types

type Handler

type Handler interface {
	HandleMetric(m *Metric)
}

Objects implementing the Handler interface can be used to handle metrics for a Server

type HandlerFunc

type HandlerFunc func(*Metric)

The HandlerFunc type is an adapter to allow the use of ordinary functions as metric handlers

func (HandlerFunc) HandleMetric

func (f HandlerFunc) HandleMetric(m *Metric)

HandleMetric calls f(m)

type Metric

type Metric struct {
	Type   MetricType // The type of metric
	Bucket string     // The name of the bucket where the metric belongs
	Value  float64    // The numeric value of the metric
}

Metric represents a single data collected datapoint

func (Metric) String

func (m Metric) String() string

type MetricType

type MetricType int

MetricType is an enumeration of all the possible types of Metric

const (
	COUNTER MetricType = iota
	TIMER
	GAUGE
	GAUGE_DELTA
	SET
)

func (MetricType) String

func (m MetricType) String() string

type Server

type Server struct {
	Addr    string  // UDP address on which to listen for metrics
	Handler Handler // handler to invoke
	// contains filtered or unexported fields
}

Server receives data on its listening port and converts lines in to Metrics. For each Metric it calls r.Handler.HandleMetric()

func (*Server) Close

func (r *Server) Close() error

func (*Server) Listen

func (r *Server) Listen() error

func (*Server) ListenAndReceive

func (r *Server) ListenAndReceive() error

ListenAndReceive listens on the UDP network address of srv.Addr and then calls Receive to handle the incoming datagrams. If Addr is blank then DefaultMetricsAddr is used.

func (*Server) Receive

func (r *Server) Receive(c net.PacketConn) error

Receive accepts incoming datagrams on c and calls r.Handler.HandleMetric() for each line in the datagram that successfully parses in to a Metric

Jump to

Keyboard shortcuts

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