• Miek Gieben's avatar
    plugin/metrics: convience MustRegister function (#1332) · 99047aee
    Miek Gieben authored
    This leave most of the code intact, but we need to stop vendoring
    prometheus, because, again, plugins what want to use it. Not vendoring
    prometheus makes my forward metrics show up again. Code looks bit
    convoluted, but works:
    
    ~~~
    	c.OnStartup(func() error {
    		once.Do(func() {
    			m := dnsserver.GetConfig(c).Handler("prometheus")
    			if m == nil {
    				return
    			}
    			if x, ok := m.(*metrics.Metrics); ok {
    				x.MustRegister(RequestCount)
    				x.MustRegister(RcodeCount)
    				x.MustRegister(RequestDuration)
    				x.MustRegister(HealthcheckFailureCount)
    				x.MustRegister(SocketGauge)
    			}
    		})
    	})
    ~~~
    99047aee
metrics.go 2.72 KB