Documentation ¶
Index ¶
- Variables
- type Logger
- type NoopClient
- func (s NoopClient) Absolute(stat string, value int64) error
- func (s NoopClient) Close() error
- func (s NoopClient) CreateSocket() error
- func (s NoopClient) Decr(stat string, count int64) error
- func (s NoopClient) FAbsolute(stat string, value float64) error
- func (s NoopClient) FGauge(stat string, value float64) error
- func (s NoopClient) FGaugeDelta(stat string, value float64) error
- func (s NoopClient) Gauge(stat string, value int64) error
- func (s NoopClient) GaugeDelta(stat string, value int64) error
- func (s NoopClient) Incr(stat string, count int64) error
- func (s NoopClient) PrecisionTiming(stat string, delta time.Duration) error
- func (s NoopClient) Timing(stat string, count int64) error
- func (s NoopClient) Total(stat string, value int64) error
- type Statsd
- type StatsdBuffer
- func (sb *StatsdBuffer) Absolute(stat string, value int64) error
- func (sb *StatsdBuffer) Close() (err error)
- func (sb *StatsdBuffer) CreateSocket() error
- func (sb *StatsdBuffer) Decr(stat string, count int64) error
- func (sb *StatsdBuffer) FAbsolute(stat string, value float64) error
- func (sb *StatsdBuffer) FGauge(stat string, value float64) error
- func (sb *StatsdBuffer) FGaugeDelta(stat string, value float64) error
- func (sb *StatsdBuffer) Gauge(stat string, value int64) error
- func (sb *StatsdBuffer) GaugeDelta(stat string, value int64) error
- func (sb *StatsdBuffer) Incr(stat string, count int64) error
- func (sb *StatsdBuffer) PrecisionTiming(stat string, delta time.Duration) error
- func (sb *StatsdBuffer) Timing(stat string, delta int64) error
- func (sb *StatsdBuffer) Total(stat string, value int64) error
- type StatsdClient
- func (c *StatsdClient) Absolute(stat string, value int64) error
- func (c *StatsdClient) Close() error
- func (c *StatsdClient) CreateSocket() error
- func (c *StatsdClient) Decr(stat string, count int64) error
- func (c *StatsdClient) FAbsolute(stat string, value float64) error
- func (c *StatsdClient) FGauge(stat string, value float64) error
- func (c *StatsdClient) FGaugeDelta(stat string, value float64) error
- func (c *StatsdClient) Gauge(stat string, value int64) error
- func (c *StatsdClient) GaugeDelta(stat string, value int64) error
- func (c *StatsdClient) Incr(stat string, count int64) error
- func (c *StatsdClient) PrecisionTiming(stat string, delta time.Duration) error
- func (c *StatsdClient) SendEvent(e event.Event) error
- func (c *StatsdClient) String() string
- func (c *StatsdClient) Timing(stat string, delta int64) error
- func (c *StatsdClient) Total(stat string, value int64) error
Constants ¶
This section is empty.
Variables ¶
var Hostname string
note Hostname is exported so clients can set it to something different than the default
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Println(v ...interface{})
}
Logger interface compatible with log.Logger
type NoopClient ¶
type NoopClient struct{}
NoopClient implements a "no-op" statsd in case there is no statsd server
func (NoopClient) Absolute ¶
func (s NoopClient) Absolute(stat string, value int64) error
Absolute does nothing
func (NoopClient) FAbsolute ¶
func (s NoopClient) FAbsolute(stat string, value float64) error
FAbsolute does nothing
func (NoopClient) FGauge ¶
func (s NoopClient) FGauge(stat string, value float64) error
FGauge does nothing
func (NoopClient) FGaugeDelta ¶
func (s NoopClient) FGaugeDelta(stat string, value float64) error
FGaugeDelta does nothing
func (NoopClient) Gauge ¶
func (s NoopClient) Gauge(stat string, value int64) error
Gauge does nothing
func (NoopClient) GaugeDelta ¶
func (s NoopClient) GaugeDelta(stat string, value int64) error
GaugeDelta does nothing
func (NoopClient) PrecisionTiming ¶
func (s NoopClient) PrecisionTiming(stat string, delta time.Duration) error
PrecisionTiming does nothing
type Statsd ¶
type Statsd interface { CreateSocket() error Close() error Incr(stat string, count int64) error Decr(stat string, count int64) error Timing(stat string, delta int64) error PrecisionTiming(stat string, delta time.Duration) error Gauge(stat string, value int64) error GaugeDelta(stat string, value int64) error Absolute(stat string, value int64) error Total(stat string, value int64) error FGauge(stat string, value float64) error FGaugeDelta(stat string, value float64) error FAbsolute(stat string, value float64) error }
Statsd is an interface to a StatsD client (buffered/unbuffered)
type StatsdBuffer ¶
type StatsdBuffer struct { Logger Logger // contains filtered or unexported fields }
StatsdBuffer is a client library to aggregate events in memory before flushing aggregates to StatsD, useful if the frequency of events is extremely high and sampling is not desirable
func NewStatsdBuffer ¶
func NewStatsdBuffer(interval time.Duration, client *StatsdClient) *StatsdBuffer
NewStatsdBuffer Factory
func (*StatsdBuffer) Absolute ¶
func (sb *StatsdBuffer) Absolute(stat string, value int64) error
Absolute - Send absolute-valued metric (not averaged/aggregated)
func (*StatsdBuffer) Close ¶
func (sb *StatsdBuffer) Close() (err error)
Close sends a close event to the collector asking to stop & flush pending stats and closes the statsd client
func (*StatsdBuffer) CreateSocket ¶
func (sb *StatsdBuffer) CreateSocket() error
CreateSocket creates a UDP connection to a StatsD server
func (*StatsdBuffer) Decr ¶
func (sb *StatsdBuffer) Decr(stat string, count int64) error
Decr - Decrement a counter metric. Often used to note a particular event
func (*StatsdBuffer) FAbsolute ¶
func (sb *StatsdBuffer) FAbsolute(stat string, value float64) error
FAbsolute - Send absolute-valued metric (not averaged/aggregated)
func (*StatsdBuffer) FGauge ¶
func (sb *StatsdBuffer) FGauge(stat string, value float64) error
FGauge is a Gauge working with float64 values
func (*StatsdBuffer) FGaugeDelta ¶
func (sb *StatsdBuffer) FGaugeDelta(stat string, value float64) error
FGaugeDelta records a delta from the previous value (as float64)
func (*StatsdBuffer) Gauge ¶
func (sb *StatsdBuffer) Gauge(stat string, value int64) error
Gauge - Gauges are a constant data type. They are not subject to averaging, and they don’t change unless you change them. That is, once you set a gauge value, it will be a flat line on the graph until you change it again
func (*StatsdBuffer) GaugeDelta ¶
func (sb *StatsdBuffer) GaugeDelta(stat string, value int64) error
GaugeDelta records a delta from the previous value (as int64)
func (*StatsdBuffer) Incr ¶
func (sb *StatsdBuffer) Incr(stat string, count int64) error
Incr - Increment a counter metric. Often used to note a particular event
func (*StatsdBuffer) PrecisionTiming ¶
func (sb *StatsdBuffer) PrecisionTiming(stat string, delta time.Duration) error
PrecisionTiming - Track a duration event the time delta has to be a duration
type StatsdClient ¶
type StatsdClient struct { Logger Logger // contains filtered or unexported fields }
StatsdClient is a client library to send events to StatsD
func NewStatsdClient ¶
func NewStatsdClient(addr string, prefix string) *StatsdClient
NewStatsdClient - Factory
func (*StatsdClient) Absolute ¶
func (c *StatsdClient) Absolute(stat string, value int64) error
Absolute - Send absolute-valued metric (not averaged/aggregated)
func (*StatsdClient) CreateSocket ¶
func (c *StatsdClient) CreateSocket() error
CreateSocket creates a UDP connection to a StatsD server
func (*StatsdClient) Decr ¶
func (c *StatsdClient) Decr(stat string, count int64) error
Decr - Decrement a counter metric. Often used to note a particular event
func (*StatsdClient) FAbsolute ¶
func (c *StatsdClient) FAbsolute(stat string, value float64) error
FAbsolute - Send absolute-valued floating point metric (not averaged/aggregated)
func (*StatsdClient) FGauge ¶
func (c *StatsdClient) FGauge(stat string, value float64) error
FGauge -- Send a floating point value for a gauge
func (*StatsdClient) FGaugeDelta ¶
func (c *StatsdClient) FGaugeDelta(stat string, value float64) error
FGaugeDelta -- Send a floating point change for a gauge
func (*StatsdClient) Gauge ¶
func (c *StatsdClient) Gauge(stat string, value int64) error
Gauge - Gauges are a constant data type. They are not subject to averaging, and they don’t change unless you change them. That is, once you set a gauge value, it will be a flat line on the graph until you change it again. If you specify delta to be true, that specifies that the gauge should be updated, not set. Due to the underlying protocol, you can't explicitly set a gauge to a negative number without first setting it to zero.
func (*StatsdClient) GaugeDelta ¶
func (c *StatsdClient) GaugeDelta(stat string, value int64) error
GaugeDelta -- Send a change for a gauge
func (*StatsdClient) Incr ¶
func (c *StatsdClient) Incr(stat string, count int64) error
Incr - Increment a counter metric. Often used to note a particular event
func (*StatsdClient) PrecisionTiming ¶
func (c *StatsdClient) PrecisionTiming(stat string, delta time.Duration) error
PrecisionTiming - Track a duration event the time delta has to be a duration
func (*StatsdClient) SendEvent ¶
func (c *StatsdClient) SendEvent(e event.Event) error
SendEvent - Sends stats from an event object
func (*StatsdClient) String ¶
func (c *StatsdClient) String() string
String returns the StatsD server address