Fission metrics integration (#677)

Add prometheus metrics collection endpoints to router and executor. Add prometheus annotations to router and executor pods.
This commit is contained in:
Soam Vasani
2018-05-21 13:57:18 -07:00
committed by GitHub
parent d9b5b9b8a8
commit d846aed612
11 changed files with 322 additions and 11 deletions
+9
View File
@@ -47,6 +47,7 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/fission/fission"
"github.com/fission/fission/crd"
@@ -71,6 +72,12 @@ func serve(ctx context.Context, port int, httpTriggerSet *HTTPTriggerSet, resolv
http.ListenAndServe(url, mr)
}
func serveMetric() {
// Expose the registered metrics via HTTP.
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(metricAddr, nil))
}
func Start(port int, executorUrl string) {
// setup a signal handler for SIGTERM
fission.SetupStackTraceHandler()
@@ -93,6 +100,8 @@ func Start(port int, executorUrl string) {
triggers, _, fnStore := makeHTTPTriggerSet(fmap, fissionClient, executor, restClient)
resolver := makeFunctionReferenceResolver(fnStore)
go serveMetric()
log.Printf("Starting router at port %v\n", port)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()