Documentation ¶
Overview ¶
Package graphite implements a Graphite backend for package metrics. Metrics will be emitted to a Graphite server in the plaintext protocol which looks like:
"<metric path> <metric value> <metric timestamp>"
See http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol. The current implementation ignores fields.
Index ¶
- type Dialer
- type Emitter
- func (e *Emitter) Flush()
- func (e *Emitter) NewCounter(name string) metrics.Counter
- func (e *Emitter) NewGauge(name string) metrics.Gauge
- func (e *Emitter) NewHistogram(name string, minValue, maxValue int64, sigfigs int, quantiles ...int) (metrics.Histogram, error)
- func (e *Emitter) NewTimeHistogram(name string, unit time.Duration, minValue, maxValue int64, sigfigs int, ...) (metrics.TimeHistogram, error)
- func (e *Emitter) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter will keep track of all metrics and, once started, will emit the metrics via the Flush method to the given address.
func NewEmitter ¶
func NewEmitter(network, address string, metricsPrefix string, flushInterval time.Duration, logger log.Logger) *Emitter
NewEmitter will return an Emitter that will prefix all metrics names with the given prefix. Once started, it will attempt to create a connection with the given network and address via `net.Dial` and periodically post metrics to the connection in the Graphite plaintext protocol.
func NewEmitterDial ¶
func NewEmitterDial(dialer Dialer, network, address string, metricsPrefix string, flushInterval time.Duration, logger log.Logger) *Emitter
NewEmitterDial is the same as NewEmitter, but allows you to specify your own Dialer function. This is primarily useful for tests.
func (*Emitter) Flush ¶
func (e *Emitter) Flush()
Flush will write the current metrics to the Emitter's connection in the Graphite plaintext protocol.
func (*Emitter) NewCounter ¶
NewCounter returns a Counter whose value will be periodically emitted in a Graphite-compatible format once the Emitter is started. Fields are ignored.
func (*Emitter) NewGauge ¶
NewGauge returns a Gauge whose value will be periodically emitted in a Graphite-compatible format once the Emitter is started. Fields are ignored.
func (*Emitter) NewHistogram ¶
func (e *Emitter) NewHistogram(name string, minValue, maxValue int64, sigfigs int, quantiles ...int) (metrics.Histogram, error)
NewHistogram is taken from http://github.com/codahale/metrics. It returns a windowed HDR histogram which drops data older than five minutes.
The histogram exposes metrics for each passed quantile as gauges. Quantiles should be integers in the range 1..99. The gauge names are assigned by using the passed name as a prefix and appending "_pNN" e.g. "_p50".
The values of this histogram will be periodically emitted in a Graphite-compatible format once the Emitter is started. Fields are ignored.
func (*Emitter) NewTimeHistogram ¶
func (e *Emitter) NewTimeHistogram(name string, unit time.Duration, minValue, maxValue int64, sigfigs int, quantiles ...int) (metrics.TimeHistogram, error)
NewTimeHistogram returns a TimeHistogram wrapper around the windowed HDR histrogram provided by this package.