示例#1
0
文件: kontrol.go 项目: koding/koding
func logCountMetric(m *metrics.DogStatsD, name, funcName string, value int64) {
	if err := m.Count(
		name,  // metric name
		value, // count
		[]string{"funcName:" + funcName}, // tags for metric call
		1.0, // rate
	); err != nil {
		// TODO(cihangir) should we log/return error?
	}
}
示例#2
0
文件: kontrol.go 项目: koding/koding
func logGaugeMetric(m *metrics.DogStatsD, name, funcName string, value float64) {
	if err := m.Gauge(
		name,  // metric name
		value, // count
		// using funcName: for consistency with callCount
		[]string{"funcName:" + funcName},
		1.0, // rate
	); err != nil {
		// TODO(cihangir) should we log/return error?
	}
}
示例#3
0
文件: kite.go 项目: koding/koding
func createTracker(metrics *metrics.DogStatsD) kite.HandlerFunc {
	return func(r *kite.Request) (interface{}, error) {
		// if metrics not set, act as noop
		if metrics == nil {
			return true, nil
		}

		if err := metrics.Count(
			"callCount", // metric name
			1,           // count
			[]string{"funcName:" + r.Method}, // tags for metric call
			1.0, // rate
		); err != nil {
			// TODO(cihangir) should we log/return error?
		}

		return true, nil
	}
}