Prometheus metrics improvements (#2398)
- Enabled metrics in storagesvc, buildermgr and controller. - Added a middleware in storagesvc, router, executor and controller to monitor total number of http requests, each request's duration and number of requests that are currently being served. These requests can be filtered on their path, method or statuscode. - Removed functionCallDuration and functionCallResponseSize metrics from router. - Removed funcAliveSummary, funcIsAlive, funcReapTime and idleTime metrics. - Replaced function calls for collecting metrics to direct metric calls. Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Sanket Sudake
parent
7f89c07c35
commit
74e4b67a47
@@ -35,6 +35,7 @@ import (
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
"github.com/fission/fission/pkg/fission-cli/logdb"
|
||||
"github.com/fission/fission/pkg/info"
|
||||
"github.com/fission/fission/pkg/utils/metrics"
|
||||
"github.com/fission/fission/pkg/utils/otel"
|
||||
)
|
||||
|
||||
@@ -198,6 +199,7 @@ func (api *API) GetSvcName(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (api *API) GetHandler() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
r.Use(metrics.HTTPMetricMiddleware())
|
||||
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
|
||||
// Give a useful error message if an older CLI attempts to make a request
|
||||
r.HandleFunc(`/v1/{rest:[a-zA-Z0-9=\-\/]+}`, api.ApiVersionMismatchHandler)
|
||||
@@ -267,7 +269,7 @@ func (api *API) GetHandler() http.Handler {
|
||||
return r
|
||||
}
|
||||
|
||||
func (api *API) Serve(port int, openTracingEnabled bool) {
|
||||
func (api *API) Serve(ctx context.Context, port int, openTracingEnabled bool) {
|
||||
address := fmt.Sprintf(":%v", port)
|
||||
api.logger.Info("server started", zap.Int("port", port))
|
||||
|
||||
@@ -277,6 +279,8 @@ func (api *API) Serve(port int, openTracingEnabled bool) {
|
||||
} else {
|
||||
handler = otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
|
||||
}
|
||||
|
||||
go metrics.ServeMetrics(ctx, api.logger)
|
||||
err := http.ListenAndServe(address, handler)
|
||||
api.logger.Fatal("done listening", zap.Error(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user