mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user