func NewPerFSStat(m *metrics.MetricContext, mp string) *PerFSStat { c := new(PerFSStat) c.mp = mp c.Metrics = new(PerFSStatMetrics) misc.InitializeMetrics(c.Metrics, m, "fsstat."+mp, true) return c }
func NewPerInterfaceStat(m *metrics.MetricContext, dev string) *PerInterfaceStat { c := new(PerInterfaceStat) c.Metrics = new(PerInterfaceStatMetrics) // initialize all metrics and register them misc.InitializeMetrics(c.Metrics, m, "interfacestat."+dev, true) return c }
// NewCPUStatPerCPU returns a struct representing counters for // per CPU statistics func NewCPUStatPerCPU(m *metrics.MetricContext, name string) *CPUStatPerCPU { o := new(CPUStatPerCPU) // initialize all metrics and register them misc.InitializeMetrics(o, m, "cpustat."+name, true) return o }
func NewPerDiskStat(m *metrics.MetricContext, blkdev string) *PerDiskStat { c := new(PerDiskStat) c.Metrics = new(PerDiskStatMetrics) // initialize all metrics and register them misc.InitializeMetrics(c.Metrics, m, "diskstat."+blkdev, true) return c }
// CPUStatPerCPUNew returns a struct representing counters for // per CPU statistics func CPUStatPerCPUNew(m *metrics.MetricContext, cpu string) *CPUStatPerCPU { o := new(CPUStatPerCPU) // initialize metrics and register // XXX: need to adopt it to similar to linux and pass // cpu name as argument when we are collecting per cpu // information misc.InitializeMetrics(o, m, "cpustat.cpu", true) return o }
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics { s := new(PerProcessStatMetrics) s.Pid = pid // initialize all metrics misc.InitializeMetrics(s, m, "IGNORE") return s }
func NewPerCgroupStatMetrics(m *metrics.MetricContext, path string, mp string) *PerCgroupStatMetrics { c := new(PerCgroupStatMetrics) c.path = path // initialize all metrics and register them prefix, _ := filepath.Rel(mp, path) misc.InitializeMetrics(c, m, "cpustat.cgroup."+prefix, true) return c }
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics { s := new(PerProcessStatMetrics) s.Pid = pid s.m = m // initialize all metrics but do NOT register them // registration happens if the objects pass user // supplied filter misc.InitializeMetrics(s, m, "IGNORE", false) return s }
func NewPerCgroupStatMetrics(m *metrics.MetricContext, path string, mp string) *PerCgroupStatMetrics { c := new(PerCgroupStatMetrics) c.path = path prefix, _ := filepath.Rel(mp, path) // initialize all metrics misc.InitializeMetrics(c, m, "memstat.cgroup."+prefix) return c }
func MemStatMetricsNew(m *metrics.MetricContext, Step time.Duration) *MemStatMetrics { c := new(MemStatMetrics) misc.InitializeMetrics(c, m, "memstat") // collect once c.Collect() // collect metrics every Step ticker := time.NewTicker(Step) go func() { for _ = range ticker.C { c.Collect() } }() return c }
func MemStatMetricsNew(m *metrics.MetricContext, Step time.Duration) *MemStatMetrics { c := new(MemStatMetrics) // initialize all gauges misc.InitializeMetrics(c, m, "memstat") host := C.mach_host_self() C.host_page_size(C.host_t(host), &c.Pagesize) // collect metrics every Step ticker := time.NewTicker(Step) go func() { for _ = range ticker.C { c.Collect() } }() return c }
//initializes metrics func MysqlStatMetricsNew(m *metrics.MetricContext, Step time.Duration) *MysqlStatMetrics { c := new(MysqlStatMetrics) misc.InitializeMetrics(c, m, "mysqlstat", true) return c }
// NewCPUStatPerCPU returns a struct representing counters for // per CPU statistics func NewCPUStatPerCPU(m *metrics.MetricContext, name string) *CPUStatPerCPU { o := new(CPUStatPerCPU) misc.InitializeMetrics(o, m, "cpustat."+name) return o }
func NewPerDiskStat(m *metrics.MetricContext, blkdev string) *PerDiskStat { c := new(PerDiskStat) c.Metrics = new(PerDiskStatMetrics) misc.InitializeMetrics(c.Metrics, m, "diskstat."+blkdev) return c }
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics { s := new(PerProcessStatMetrics) // initialize all metrics misc.InitializeMetrics(s, m, "pidstat."+pid) return s }
//initialize per database metrics func newMysqlStatPerDB(m *metrics.MetricContext, dbname string) *MysqlStatPerDB { o := new(MysqlStatPerDB) misc.InitializeMetrics(o, m, "mysqldbstat."+dbname, true) return o }
//initialize per table metrics func newMysqlStatPerTable(m *metrics.MetricContext, dbname, tblname string) *MysqlStatPerTable { o := new(MysqlStatPerTable) misc.InitializeMetrics(o, m, "mysqltablestat."+dbname+"."+tblname, true) return o }
// CPUStatPerCPUNew returns a struct representing counters for // per CPU statistics func CPUStatPerCPUNew(m *metrics.MetricContext, cpu string) *CPUStatPerCPU { o := new(CPUStatPerCPU) misc.InitializeMetrics(o, m, "cpustat."+cpu) return o }
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics { s := new(PerProcessStatMetrics) // initialize all metrics and do NOT register for now misc.InitializeMetrics(s, m, "pidstat.", false) return s }
func NewPerInterfaceStat(m *metrics.MetricContext, dev string) *PerInterfaceStat { c := new(PerInterfaceStat) c.Metrics = new(PerInterfaceStatMetrics) misc.InitializeMetrics(c.Metrics, m, "interfacestat."+dev) return c }