Implement configurable scaling PoC
This commit is contained in:
+9
-5
@@ -10,7 +10,8 @@ import (
|
||||
|
||||
type Manager interface {
|
||||
Publisher
|
||||
Fetcher
|
||||
Fetch(name string) Stats
|
||||
Reset()
|
||||
}
|
||||
|
||||
type Publisher interface {
|
||||
@@ -18,10 +19,6 @@ type Publisher interface {
|
||||
Error(name string)
|
||||
}
|
||||
|
||||
type Fetcher interface {
|
||||
Fetch(name string) Stats
|
||||
}
|
||||
|
||||
type Stats interface {
|
||||
Processed() int64
|
||||
Errors() int64
|
||||
@@ -62,6 +59,13 @@ func (b *base) Fetch(name string) Stats {
|
||||
return b.metrics(name)
|
||||
}
|
||||
|
||||
func (b *base) Reset() {
|
||||
for _, s := range b.stats {
|
||||
s.time.Clear()
|
||||
s.errors.Clear()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *baseStats) Processed() int64 {
|
||||
return s.time.Count()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user