Example #1
0
// status calc
func monitor() {
	startTs := time.Now().Unix()
	_monitor()
	endTs := time.Now().Unix()
	log.Printf("monitor, startTs %s, time-consuming %d sec\n", ntime.FormatTs(startTs), endTs-startTs)

	// statistics
	pfc.Meter("MonitorCronCnt", 1)
	pfc.Gauge("MonitorCronTs", endTs-startTs)
}
Example #2
0
func basic() {
	for _ = range time.Tick(time.Second * time.Duration(10)) {
		// (常用) Meter,用于累加求和、计算变化率。使用场景如,统计首页访问次数、gvm的CG次数等。
		pv := int64(rand.Int() % 100)
		pfc.Meter("test.meter", pv)
		pfc.Meter("test.meter.2", pv-50)

		// (常用) Gauge,用于保存数值类型的瞬时记录值。使用场景如,统计队列长度、统计CPU使用率等
		queueSize := int64(rand.Int()%100 - 50)
		pfc.Gauge("test.gauge", queueSize)

		cpuUtil := float64(rand.Int()%10000) / float64(100)
		pfc.GaugeFloat64("test.gauge.float64", cpuUtil)
	}
}
Example #3
0
func refreshSendingCacheSize() {
	pfc.Gauge("SendQueueSize", int64(SenderQueue.Len()))
}