middleware/metrics: export ListenAddr (#366)

ListenAddr is the address where the prometheus metric are exported.
This can be used in tests to listen on "localhost:0" and then later
retrieve the metrics from there. It makes the tests indepent on each
other.
This commit is contained in:
Miek Gieben 2016-10-28 12:57:10 +01:00 committed by GitHub
parent 0509f4b4ac
commit cb867ff6bd
4 changed files with 18 additions and 14 deletions

View file

@ -38,7 +38,7 @@ func setup(c *caddy.Controller) error {
func prometheusParse(c *caddy.Controller) (*Metrics, error) {
var (
met = &Metrics{Addr: Addr, zoneMap: make(map[string]bool)}
met = &Metrics{Addr: addr, zoneMap: make(map[string]bool)}
err error
)
@ -88,4 +88,4 @@ func prometheusParse(c *caddy.Controller) (*Metrics, error) {
var metricsOnce sync.Once
// Addr is the address the where the metrics are exported by default.
const Addr = "localhost:9153"
const addr = "localhost:9153"