Example #1
0
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
}
Example #2
0
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
}
Example #3
0
// 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
}
Example #4
0
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
}
Example #5
0
// 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
}
Example #6
0
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics {
	s := new(PerProcessStatMetrics)
	s.Pid = pid

	// initialize all metrics
	misc.InitializeMetrics(s, m, "IGNORE")

	return s
}
Example #7
0
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
}
Example #8
0
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
}
Example #10
0
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
}
Example #11
0
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
}
Example #12
0
//initializes metrics
func MysqlStatMetricsNew(m *metrics.MetricContext, Step time.Duration) *MysqlStatMetrics {
	c := new(MysqlStatMetrics)
	misc.InitializeMetrics(c, m, "mysqlstat", true)
	return c
}
Example #13
0
// 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
}
Example #14
0
func NewPerDiskStat(m *metrics.MetricContext, blkdev string) *PerDiskStat {
	c := new(PerDiskStat)
	c.Metrics = new(PerDiskStatMetrics)
	misc.InitializeMetrics(c.Metrics, m, "diskstat."+blkdev)
	return c
}
Example #15
0
func NewPerProcessStatMetrics(m *metrics.MetricContext, pid string) *PerProcessStatMetrics {
	s := new(PerProcessStatMetrics)
	// initialize all metrics
	misc.InitializeMetrics(s, m, "pidstat."+pid)
	return s
}
Example #16
0
//initialize  per database metrics
func newMysqlStatPerDB(m *metrics.MetricContext, dbname string) *MysqlStatPerDB {
	o := new(MysqlStatPerDB)
	misc.InitializeMetrics(o, m, "mysqldbstat."+dbname, true)
	return o
}
Example #17
0
//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
}
Example #18
0
// 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
}
Example #19
0
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
}
Example #20
0
func NewPerInterfaceStat(m *metrics.MetricContext, dev string) *PerInterfaceStat {
	c := new(PerInterfaceStat)
	c.Metrics = new(PerInterfaceStatMetrics)
	misc.InitializeMetrics(c.Metrics, m, "interfacestat."+dev)
	return c
}