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 {
|
||||
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
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue