Documentation ¶
Index ¶
- Constants
- func DestroySender(id check.ID)
- func SetDefaultAggregator(agg *BufferedAggregator)
- func SetSender(sender Sender, id check.ID) error
- type BufferedAggregator
- func InitAggregator(s *serializer.Serializer, hostname string) *BufferedAggregator
- func InitAggregatorWithFlushInterval(s *serializer.Serializer, hostname string, flushInterval time.Duration) *BufferedAggregator
- func NewBufferedAggregator(s *serializer.Serializer, hostname string, flushInterval time.Duration) *BufferedAggregator
- func (agg *BufferedAggregator) AddAgentStartupEvent(agentVersion string)
- func (agg *BufferedAggregator) GetChannels() (chan *metrics.MetricSample, chan metrics.Event, chan metrics.ServiceCheck)
- func (agg *BufferedAggregator) GetEvents() metrics.Events
- func (agg *BufferedAggregator) GetSeries() metrics.Series
- func (agg *BufferedAggregator) GetServiceChecks() metrics.ServiceChecks
- func (agg *BufferedAggregator) GetSketches() percentile.SketchSeriesList
- func (agg *BufferedAggregator) IsInputQueueEmpty() bool
- func (agg *BufferedAggregator) SetHostname(hostname string)
- type CheckSampler
- type Context
- type ContextResolver
- type DistSampler
- type MockSender
- func (m *MockSender) Commit()
- func (m *MockSender) Count(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) Counter(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) Event(e metrics.Event)
- func (m *MockSender) Gauge(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) GetMetricStats() map[string]int64
- func (m *MockSender) Histogram(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) Historate(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) MonotonicCount(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) Rate(metric string, value float64, hostname string, tags []string)
- func (m *MockSender) ServiceCheck(checkName string, status metrics.ServiceCheckStatus, hostname string, ...)
- type RawSender
- type Sender
- type SerieSignature
- type Stats
- type TimeSampler
Constants ¶
const DefaultFlushInterval = 15 * time.Second // flush interval
DefaultFlushInterval aggregator default flush interval
Variables ¶
This section is empty.
Functions ¶
func DestroySender ¶
DestroySender frees up the resources used by the sender with passed ID (by deregistering it from the aggregator) Should be called when no sender with this ID is used anymore The metrics of this (these) sender(s) that haven't been flushed yet will be lost
func SetDefaultAggregator ¶
func SetDefaultAggregator(agg *BufferedAggregator)
SetDefaultAggregator allows to force a custom Aggregator as the default one and run it. This is usefull for testing or benchmarking.
Types ¶
type BufferedAggregator ¶
type BufferedAggregator struct { TickerChan <-chan time.Time // For test/benchmark purposes: it allows the flush to be controlled from the outside // contains filtered or unexported fields }
BufferedAggregator aggregates metrics in buckets for dogstatsd Metrics
func InitAggregator ¶
func InitAggregator(s *serializer.Serializer, hostname string) *BufferedAggregator
InitAggregator returns the Singleton instance
func InitAggregatorWithFlushInterval ¶
func InitAggregatorWithFlushInterval(s *serializer.Serializer, hostname string, flushInterval time.Duration) *BufferedAggregator
InitAggregatorWithFlushInterval returns the Singleton instance with a configured flush interval
func NewBufferedAggregator ¶
func NewBufferedAggregator(s *serializer.Serializer, hostname string, flushInterval time.Duration) *BufferedAggregator
NewBufferedAggregator instantiates a BufferedAggregator
func (*BufferedAggregator) AddAgentStartupEvent ¶
func (agg *BufferedAggregator) AddAgentStartupEvent(agentVersion string)
AddAgentStartupEvent adds the startup event to the events that'll be sent on the next flush
func (*BufferedAggregator) GetChannels ¶
func (agg *BufferedAggregator) GetChannels() (chan *metrics.MetricSample, chan metrics.Event, chan metrics.ServiceCheck)
GetChannels returns a channel which can be subsequently used to send MetricSamples, Event or ServiceCheck
func (*BufferedAggregator) GetEvents ¶
func (agg *BufferedAggregator) GetEvents() metrics.Events
GetEvents grabs the events from the queue and clears it
func (*BufferedAggregator) GetSeries ¶
func (agg *BufferedAggregator) GetSeries() metrics.Series
GetSeries grabs all the series from the queue and clears the queue
func (*BufferedAggregator) GetServiceChecks ¶
func (agg *BufferedAggregator) GetServiceChecks() metrics.ServiceChecks
GetServiceChecks grabs all the service checks from the queue and clears the queue
func (*BufferedAggregator) GetSketches ¶
func (agg *BufferedAggregator) GetSketches() percentile.SketchSeriesList
GetSketches grabs all the sketches from the queue and clears the queue
func (*BufferedAggregator) IsInputQueueEmpty ¶
func (agg *BufferedAggregator) IsInputQueueEmpty() bool
IsInputQueueEmpty returns true if every input channel for the aggregator are empty. This is mainly usefull for tests and benchmark
func (*BufferedAggregator) SetHostname ¶
func (agg *BufferedAggregator) SetHostname(hostname string)
SetHostname sets the hostname that the aggregator uses by default on all the data it sends Blocks until the main aggregator goroutine has finished handling the update
type CheckSampler ¶
type CheckSampler struct {
// contains filtered or unexported fields
}
CheckSampler aggregates metrics from one Check instance
type Context ¶
Context holds the elements that form a context, and can be serialized into a context key
type ContextResolver ¶
type ContextResolver struct {
// contains filtered or unexported fields
}
ContextResolver allows tracking and expiring contexts
type DistSampler ¶
type DistSampler struct {
// contains filtered or unexported fields
}
DistSampler creates sketches of metrics by buckets of 'interval' seconds
func NewDistSampler ¶
func NewDistSampler(interval int64, defaultHostname string) *DistSampler
NewDistSampler returns a newly initialized DistSampler
type MockSender ¶
MockSender allows mocking of the checks sender for unit testing
func NewMockSender ¶
func NewMockSender(id check.ID) *MockSender
NewMockSender initiates the aggregator and returns a functionnal mocked Sender for testing
func (*MockSender) Count ¶
func (m *MockSender) Count(metric string, value float64, hostname string, tags []string)
Count adds a count type to the mock calls.
func (*MockSender) Counter ¶
func (m *MockSender) Counter(metric string, value float64, hostname string, tags []string)
Counter adds a counter type to the mock calls.
func (*MockSender) Event ¶
func (m *MockSender) Event(e metrics.Event)
Event enables the event mock call.
func (*MockSender) Gauge ¶
func (m *MockSender) Gauge(metric string, value float64, hostname string, tags []string)
Gauge adds a gauge type to the mock calls.
func (*MockSender) GetMetricStats ¶
func (m *MockSender) GetMetricStats() map[string]int64
GetMetricStats enables the get metric stats mock call.
func (*MockSender) Histogram ¶
func (m *MockSender) Histogram(metric string, value float64, hostname string, tags []string)
Histogram adds a histogram type to the mock calls.
func (*MockSender) Historate ¶
func (m *MockSender) Historate(metric string, value float64, hostname string, tags []string)
Historate adds a historate type to the mock calls.
func (*MockSender) MonotonicCount ¶
func (m *MockSender) MonotonicCount(metric string, value float64, hostname string, tags []string)
MonotonicCount adds a monotonic count type to the mock calls.
func (*MockSender) Rate ¶
func (m *MockSender) Rate(metric string, value float64, hostname string, tags []string)
Rate adds a rate type to the mock calls.
func (*MockSender) ServiceCheck ¶
func (m *MockSender) ServiceCheck(checkName string, status metrics.ServiceCheckStatus, hostname string, tags []string, message string)
ServiceCheck enables the service check mock call.
type RawSender ¶
type RawSender interface { SendRawMetricSample(sample *metrics.MetricSample) SendRawServiceCheck(sc *metrics.ServiceCheck) Event(e metrics.Event) }
RawSender interface to submit samples to aggregator directly
type Sender ¶
type Sender interface { Commit() Gauge(metric string, value float64, hostname string, tags []string) Rate(metric string, value float64, hostname string, tags []string) Count(metric string, value float64, hostname string, tags []string) MonotonicCount(metric string, value float64, hostname string, tags []string) Counter(metric string, value float64, hostname string, tags []string) Histogram(metric string, value float64, hostname string, tags []string) Historate(metric string, value float64, hostname string, tags []string) ServiceCheck(checkName string, status metrics.ServiceCheckStatus, hostname string, tags []string, message string) Event(e metrics.Event) GetMetricStats() map[string]int64 }
Sender allows sending metrics from checks/a check
func GetDefaultSender ¶
GetDefaultSender returns the default sender
type SerieSignature ¶
type SerieSignature struct {
// contains filtered or unexported fields
}
SerieSignature holds the elements that allow to know whether two similar `Serie`s from the same bucket can be merged into one
type Stats ¶
type Stats struct { Flushes [32]int64 // circular buffer of recent flushes stat FlushIndex int // last flush position in circular buffer LastFlush int64 // most recent flush stat, provided for convenience Name string // contains filtered or unexported fields }
Stats stores a statistic from several past flushes allowing computations like median or percentiles
type TimeSampler ¶
type TimeSampler struct {
// contains filtered or unexported fields
}
TimeSampler aggregates metrics by buckets of 'interval' seconds
func NewTimeSampler ¶
func NewTimeSampler(interval int64, defaultHostname string) *TimeSampler
NewTimeSampler returns a newly initialized TimeSampler