1
0
Fork 0

Add statistics groups

This commit is contained in:
Gregory Eremin 2015-10-24 04:22:02 +03:00
parent 0e1fbbe729
commit bfa1575d79
2 changed files with 31 additions and 2 deletions

View File

@ -45,8 +45,8 @@ type Publisher interface {
}
type Statistics interface {
Add(daemonName string, dur time.Duration)
Error(daemonName string)
Add(name string, dur time.Duration)
Error(name string)
}
type task struct {

29
stats/group.go Normal file
View File

@ -0,0 +1,29 @@
package stats
import (
"time"
"github.com/localhots/satan"
)
type Group struct {
backends []satan.Statistics
}
func NewGroup(backends ...satan.Statistics) *Group {
return &Group{
backends: backends,
}
}
func (g *Group) Add(name string, dur time.Duration) {
for _, b := range g.backends {
b.Add(name, dur)
}
}
func (g *Group) Error(name string) {
for _, b := range g.backends {
b.Error(name)
}
}