Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatTags ¶
FormatTags is used by receivers and sinks to convert a map of tags into a string that can be used as a map key
Types ¶
type MockSink ¶
MockSink is the mock implementation of sink to be used in tests for mocking purposes
func NewMockSink ¶
func NewMockSink() *MockSink
NewMockSink returns the mock sink that adheres to the Sink interface and has utility methods to assert on
func (*MockSink) Handle ¶
Handle simluates piping out the metrics with tags and a value increses counters that can be asserted
func (*MockSink) NumFlushes ¶
NumFlushes returns number of times flush was called
func (*MockSink) NumInvocations ¶
NumInvocations returns the number of invocations to the handle
type PerMetricCumulativeHistogramBounds ¶
PerMetricCumulativeHistogramBounds is used to specify for which metrics cumulative histogram counters should be reported, and what bucket boundaries to use. For example, if it contains an entry {"foo", {1, 10, 100}}, for any metricTypeStat metric named *foo, four additional counters will be created, with suffixes ".less_than.{1,10,100,inf}" appended to the original metric name, representing the number of observations with observed values less than 1, 10, 100, and infinity, respectively. If multiple entries match a given metric, the first match will be used.
type Receiver ¶
type Receiver interface { Incr(name string) IncrBy(name string, amount float64) AddStat(name string, value float64) SetGauge(name string, value float64) ScopePrefix(prefix string) Receiver ScopeTags(tags Tags) Receiver Scope(prefix string, tags Tags) Receiver StartStopwatch(name string) Stopwatch }
Receiver is the interface to metrics that handles things like counters and gauges. An implementation of this receiver can be passed to flight recorder to track metrics
Null is the no op receiver
func NewReceiver ¶
NewReceiver returns an implementation of the receiver with the specified sink
type Sink ¶
type Sink interface { Handle(metric string, tags Tags, value float64, metricType metricType) error Flush() error Close() }
Sink is the interface to where the metrics get reported. Sink is the actual output pipe of the metrics reporting. An example of sink is statsd sink
var NullSink Sink = &nullSink{}
NullSink is the no op sink
func NewLocalSink ¶
func NewLocalSink(dst Sink, flushThreshold int, perMetricCumulativeHistogramBounds PerMetricCumulativeHistogramBounds) Sink
NewLocalSink returns an implementation of sink. Pass in the destination sink like statsd, and perMetricCumulativeHistogramBounds to add histogram metrics
func NewStatsdSink ¶
NewStatsdSink returns a Sink for statsd pass the address of the statsd daemon to it