plugin/metrics: Added New func (#1309)
If external plugins wanted to extend metrics there was no way since zoneNames couldn't be initialized. Now plugins can call New to get an instance of Metrics that they can extend.
This commit is contained in:
parent
2e2e5e1bec
commit
1919913c98
3 changed files with 10 additions and 8 deletions
|
@ -36,6 +36,11 @@ type Metrics struct {
|
|||
zoneMu sync.RWMutex
|
||||
}
|
||||
|
||||
// New returns a new instance of Metrics with the given address
|
||||
func New(addr string) *Metrics {
|
||||
return &Metrics{Addr: addr, zoneMap: make(map[string]bool)}
|
||||
}
|
||||
|
||||
// AddZone adds zone z to m.
|
||||
func (m *Metrics) AddZone(z string) {
|
||||
m.zoneMu.Lock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue