Commit graph

4 commits

Author SHA1 Message Date
Miek Gieben
99047aee9b
plugin/metrics: convience MustRegister function (#1332)
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)
			}
		})
	})
~~~
2017-12-27 14:14:53 +00:00
James Hartig
671d170619 plugin/metrics: Switch to using promhttp instead of deprecated Handler (#1312)
prometheus.Handler is deprecated according to the godoc for the package so
instead we're using promhttp.

Additionally, we are exposing the Registry that metrics is using so other
plugins that are not inside of coredns can read the registry. Otherwise, if
we kept using the Default one, there's no way to access that from outside
of the coredns repo since it is vendored.
2017-12-14 18:19:03 +00:00
James Hartig
1919913c98
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.
2017-12-13 16:59:10 -05:00
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Renamed from middleware/metrics/metrics.go (Browse further)