metrics/prometheus: expose metrics in prometheus format too (#17077)

* metrics/prometheus: added prometheus http server and metrics collector

* metrics/prometheus: minor cleanups

* metrics/prometheus: named keys instead name in tag

* metrics/prometheus: minor typo cleanups, sorted report
This commit is contained in:
Maxim Krasilnikov
2019-04-11 12:56:19 +03:00
committed by Péter Szilágyi
parent 74acde4b08
commit 31bc2a2434
3 changed files with 185 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"sync"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/prometheus"
)
type exp struct {
@ -42,6 +43,7 @@ func Exp(r metrics.Registry) {
// http.HandleFunc("/debug/vars", e.expHandler)
// haven't found an elegant way, so just use a different endpoint
http.Handle("/debug/metrics", h)
http.Handle("/debug/metrics/prometheus", prometheus.Handler(r))
}
// ExpHandler will return an expvar powered metrics handler.