Add configurable metrics endpoint to prometheus output (#3245)

This commit is contained in:
Paulo Cabido
2017-09-19 11:27:11 -07:00
committed by Daniel Nelson
parent a63f80e017
commit decb09e760
3 changed files with 11 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ type MetricFamily struct {
type PrometheusClient struct {
Listen string
ExpirationInterval internal.Duration `toml:"expiration_interval"`
Path string `toml:"path"`
server *http.Server
@@ -70,8 +71,12 @@ func (p *PrometheusClient) Start() error {
p.Listen = "localhost:9273"
}
if p.Path == "" {
p.Path = "/metrics"
}
mux := http.NewServeMux()
mux.Handle("/metrics", prometheus.Handler())
mux.Handle(p.Path, prometheus.Handler())
p.server = &http.Server{
Addr: p.Listen,