Add statistics fetcher interface
This commit is contained in:
parent
1550495bf9
commit
2ebd972a34
19
satan.go
19
satan.go
@ -13,7 +13,7 @@ import (
|
|||||||
type Satan struct {
|
type Satan struct {
|
||||||
SubscribeFunc SubscribeFunc
|
SubscribeFunc SubscribeFunc
|
||||||
Publisher Publisher
|
Publisher Publisher
|
||||||
Statistics Statistics
|
Statistics StatsPublisher
|
||||||
|
|
||||||
daemons []Daemon
|
daemons []Daemon
|
||||||
queue chan *task
|
queue chan *task
|
||||||
@ -44,11 +44,26 @@ type Publisher interface {
|
|||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Statistics interface {
|
type StatsManager interface {
|
||||||
|
StatsPublisher
|
||||||
|
StatsFetcher
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatsPublisher interface {
|
||||||
Add(name string, dur time.Duration)
|
Add(name string, dur time.Duration)
|
||||||
Error(name string)
|
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 {
|
type task struct {
|
||||||
daemon Daemon
|
daemon Daemon
|
||||||
actor Actor
|
actor Actor
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
backends []satan.Statistics
|
backends []satan.StatsPublisher
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGroup(backends ...satan.Statistics) *Group {
|
func NewGroup(backends ...satan.StatsPublisher) *Group {
|
||||||
return &Group{
|
return &Group{
|
||||||
backends: backends,
|
backends: backends,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user