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
+12 -2
View File
@@ -18,12 +18,14 @@ package executor
import (
"log"
"net/http"
"runtime/debug"
"strings"
"sync"
"time"
"github.com/dchest/uniuri"
"github.com/prometheus/client_golang/prometheus/promhttp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fission/fission"
@@ -202,8 +204,15 @@ func dumpStackTrace() {
debug.PrintStack()
}
// StartExecutor Starts executor and the executor components such as Poolmgr,
// deploymgr and potential future executor types
func serveMetric() {
// Expose the registered metrics via HTTP.
metricAddr := ":8080"
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(metricAddr, nil))
}
// StartExecutor Starts executor and the backend components that executor uses such as Poolmgr,
// deploymgr and potential future backends
func StartExecutor(fissionNamespace string, functionNamespace string, port int) error {
// setup a signal handler for SIGTERM
fission.SetupStackTraceHandler()
@@ -238,6 +247,7 @@ func StartExecutor(fissionNamespace string, functionNamespace string, port int)
api := MakeExecutor(gpm, ndm, fissionClient, fsCache)
go api.Serve(port)
go serveMetric()
return nil
}