3 // The MetricSink interface is used to transmit metrics information
4 // to an external system
5 type MetricSink interface {
6 // A Gauge should retain the last value it is set to
7 SetGauge(key []string, val float32)
9 // Should emit a Key/Value pair for each call
10 EmitKey(key []string, val float32)
12 // Counters should accumulate values
13 IncrCounter(key []string, val float32)
15 // Samples are for timing information, where quantiles are used
16 AddSample(key []string, val float32)
19 // BlackholeSink is used to just blackhole messages
20 type BlackholeSink struct{}
22 func (*BlackholeSink) SetGauge(key []string, val float32) {}
23 func (*BlackholeSink) EmitKey(key []string, val float32) {}
24 func (*BlackholeSink) IncrCounter(key []string, val float32) {}
25 func (*BlackholeSink) AddSample(key []string, val float32) {}
27 // FanoutSink is used to sink to fanout values to multiple sinks
28 type FanoutSink []MetricSink
30 func (fh FanoutSink) SetGauge(key []string, val float32) {
31 for _, s := range fh {
36 func (fh FanoutSink) EmitKey(key []string, val float32) {
37 for _, s := range fh {
42 func (fh FanoutSink) IncrCounter(key []string, val float32) {
43 for _, s := range fh {
44 s.IncrCounter(key, val)
48 func (fh FanoutSink) AddSample(key []string, val float32) {
49 for _, s := range fh {