1
0
Fork 0

Add statistics fetcher interface

This commit is contained in:
Gregory Eremin 2015-10-24 18:17:24 +03:00
parent 1550495bf9
commit 2ebd972a34
2 changed files with 19 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import (
type Satan struct {
SubscribeFunc SubscribeFunc
Publisher Publisher
Statistics Statistics
Statistics StatsPublisher
daemons []Daemon
queue chan *task
@ -44,11 +44,26 @@ type Publisher interface {
Close()
}
type Statistics interface {
type StatsManager interface {
StatsPublisher
StatsFetcher
}
type StatsPublisher interface {
Add(name string, dur time.Duration)
Error(name string)
}
type StatsFetcher interface {
Processed(name string) int64
Errors(name string) int64
Min(name string) int64
Max(name string) int64
P95(name string) float64
Mean(name string) float64
StdDev(name string) float64
}
type task struct {
daemon Daemon
actor Actor

View File

@ -7,10 +7,10 @@ import (
)
type Group struct {
backends []satan.Statistics
backends []satan.StatsPublisher
}
func NewGroup(backends ...satan.Statistics) *Group {
func NewGroup(backends ...satan.StatsPublisher) *Group {
return &Group{
backends: backends,
}