Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
func NewAggregator ¶
func NewAggregator(logger *pct.Logger, interval int64, collectionChan chan *Collection, spool data.Spooler) *Aggregator
type Binding ¶
type Binding struct {
// contains filtered or unexported fields
}
We use one binding per unique mm.Report interval. For example, if some monitors report every 60s and others every 10s, then there are two bindings. All monitors with the same report interval share the same binding: collectionChan to send metrics and aggregator summarizing and reporting those metrics.
type Collection ¶
type Collection struct { proto.ServiceInstance Ts int64 // UTC Unix timestamp Metrics []Metric }
All metrics from a service instance collected at the same time. Collections can come from different instances. For example, one agent can monitor two different MySQL instances.
type Config ¶
type Config struct { proto.ServiceInstance // info about external service being monitored Collect uint // how often monitor collects metrics (seconds) Report uint // how often aggregator reports metrics (seconds) }
type InstanceStats ¶
type InstanceStats struct { proto.ServiceInstance Stats map[string]*Stats // keyed on metric name }
Stats for each metric from a service instance, computed at each report interval.
type Metric ¶
type Metric struct { Name string // mysql/status/Threads_running Type string // gauge, counter, string Number float64 String string }
A single metric and its value at any time. Monitors are responsible for getting these and sending them as a Collection to an aggregator.
type Monitor ¶
type Monitor interface { Start(tickChan chan time.Time, collectionChan chan *Collection) error Stop() error Status() map[string]string TickChan() chan time.Time Config() interface{} }
Collect metrics when tickChan ticks, send to collecitonChan.
type MonitorFactory ¶
type Report ¶
type Report struct { Ts time.Time // start, UTC Duration uint // seconds Stats []*InstanceStats }