Example #1
0
// processCounters computes the outbound metrics for counters and puts them in the buffer
func (c *Counters) Process(buffer *bytes.Buffer, now int64, interval int) int64 {
	var num int64
	for key, val := range c.values {
		val := val / float64(interval)
		fmt.Fprintf(buffer, "%s %f %d\n", m20.DeriveCount(key, c.prefixRates), val, now)
		num++
	}
	return num
}
Example #2
0
// processCounters computes the outbound metrics for counters and puts them in the buffer
func (c *Counters) Process(buffer *bytes.Buffer, now int64, interval int) int64 {
	var num int64
	for key, val := range c.values {
		// The value is amortized to the interval, the default value of which is 10s, evenly.
		val := val / float64(interval)
		fmt.Fprintf(buffer, "%s %f %d\n", m20.DeriveCount(key, c.prefixRates), val, now)
		num++
	}
	return num
}