Update Prometheus client to latest version
Also let Prometheus export process and Go metrics
This commit is contained in:
1 parent
9439606c57
commit
d14502e071
852 files changed
+115709
-101480
No files matched your search
+5
-3
@@ -461,6 +461,8 @@ func main() {
|
||||
pluginConfig.ProcPath = procPath
|
||||
plugin := plugin.NewPlugin(pluginConfig)
|
||||
|
||||
metricsHandler := metricsHandler(router, allocator, ns, dnsserver)
|
||||
|
||||
// The weave script always waits for a status call to succeed,
|
||||
// so there is no point in doing "weave launch --http-addr ''".
|
||||
// This is here to support stand-alone use of weaver.
|
||||
@@ -476,7 +478,7 @@ func main() {
|
||||
router.HandleHTTP(muxRouter)
|
||||
HandleHTTP(muxRouter, version, router, allocator, defaultSubnet, ns, dnsserver, proxy, plugin, &waitReady)
|
||||
HandleHTTPPeer(muxRouter, allocator, discoveryEndpoint, token, name.String())
|
||||
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver))
|
||||
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler)
|
||||
if proxy != nil {
|
||||
muxRouter.Methods("GET").Path("/proxyaddrs").HandlerFunc(proxy.StatusHTTP)
|
||||
}
|
||||
@@ -488,7 +490,7 @@ func main() {
|
||||
if statusAddr != "" {
|
||||
muxRouter := mux.NewRouter()
|
||||
HandleHTTP(muxRouter, version, router, allocator, defaultSubnet, ns, dnsserver, proxy, plugin, &waitReady)
|
||||
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler(router, allocator, ns, dnsserver))
|
||||
muxRouter.Methods("GET").Path("/metrics").Handler(metricsHandler)
|
||||
statusMux := http.NewServeMux()
|
||||
statusMux.Handle("/", muxRouter)
|
||||
Log.Println("Listening for status+metrics requests on", statusAddr)
|
||||
@@ -497,7 +499,7 @@ func main() {
|
||||
|
||||
if metricsAddr != "" {
|
||||
metricsMux := http.NewServeMux()
|
||||
metricsMux.Handle("/metrics", metricsHandler(router, allocator, ns, dnsserver))
|
||||
metricsMux.Handle("/metrics", metricsHandler)
|
||||
Log.Println("Listening for metrics requests on", metricsAddr)
|
||||
go listenAndServeHTTP(metricsAddr, metricsMux)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
@@ -14,10 +13,9 @@ import (
|
||||
)
|
||||
|
||||
func metricsHandler(router *weave.NetworkRouter, allocator *ipam.Allocator, ns *nameserver.Nameserver, dnsserver *nameserver.DNSServer) http.Handler {
|
||||
reg := prometheus.NewRegistry()
|
||||
reg.MustRegister(prometheus.NewProcessCollector(os.Getpid(), ""))
|
||||
reg := prometheus.DefaultRegisterer
|
||||
reg.MustRegister(newMetrics(router, allocator, ns, dnsserver))
|
||||
return promhttp.HandlerFor(reg, promhttp.HandlerOpts{})
|
||||
return promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{})
|
||||
}
|
||||
|
||||
type collector struct {
|
||||
|
||||
Reference in new issue
Block a user