コード例 #1
0
ファイル: main.go プロジェクト: dbenque/hystrix-go
func timedHandler(fn func(w http.ResponseWriter, r *http.Request), stats statsd.Statter) func(w http.ResponseWriter, r *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		start := time.Now()
		fn(w, r)
		stats.TimingDuration("request", time.Since(start), 1)
	}
}
コード例 #2
0
// Emit successful actions as `$action.success.$event-name`
func EmitActionSuccessTiming(stats statsd.Statter, action, eventName string, took time.Duration) (err error) {
	action = CleanStatsdComponent(action)
	eventName = CleanStatsdComponent(eventName)
	if stats != nil {
		err = stats.TimingDuration(StatsdEventName(action, eventName), took, StatsSampleRate)
	}
	return
}