mm

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2015 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetricTypes map[string]bool = map[string]bool{
	"gauge":   true,
	"counter": true,
}

Functions

func GoTime

func GoTime(interval, unixTs int64) time.Time

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

func (*Aggregator) Start

func (a *Aggregator) Start()

@goroutine[0]

func (*Aggregator) Stop

func (a *Aggregator) Stop()

@goroutine[0]

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 ErrValueLap added in v1.0.11

type ErrValueLap struct {
	Timestamps []int64
	Numbers    []float64
}

func (ErrValueLap) Error added in v1.0.11

func (e ErrValueLap) Error() string

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 Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(logger *pct.Logger, factory MonitorFactory, clock ticker.Manager, spool data.Spooler, im *instance.Repo, mrm mrms.Monitor) *Manager

func (*Manager) GetConfig

func (m *Manager) GetConfig() ([]proto.AgentConfig, []error)

func (*Manager) Handle

func (m *Manager) Handle(cmd *proto.Cmd) *proto.Reply

@goroutine[0]

func (*Manager) Start

func (m *Manager) Start() error

@goroutine[0]

func (*Manager) Status

func (m *Manager) Status() map[string]string

@goroutine[1]

func (*Manager) Stop

func (m *Manager) Stop() error

@goroutine[0]

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 MonitorFactory interface {
	Make(service string, instanceId uint, data []byte) (Monitor, error)
}

type Report

type Report struct {
	Ts       time.Time // start, UTC
	Duration uint      // seconds
	Stats    []*InstanceStats
}

type Stats

type Stats struct {
	Cnt   int
	Min   float64
	Pct5  float64
	Avg   float64
	Med   float64
	Pct95 float64
	Max   float64
	// contains filtered or unexported fields
}

func NewStats

func NewStats(metricType string) (*Stats, error)

func (*Stats) Add

func (s *Stats) Add(m *Metric, ts int64) error

func (*Stats) Finalize added in v1.0.8

func (s *Stats) Finalize() *Stats

func (*Stats) Reset added in v1.0.7

func (s *Stats) Reset()

func (*Stats) Summarize

func (s *Stats) Summarize()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL