mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Introduce gateway_function_invocation_total to track individual functions
Introduce prometheus_alertmanager into stack - have it fire into webhook stash
This commit is contained in:
@ -72,6 +72,8 @@ func isAlexa(requestBody []byte) AlexaRequestBody {
|
||||
}
|
||||
|
||||
func invokeService(w http.ResponseWriter, r *http.Request, metrics metrics.MetricOptions, service string, requestBody []byte) {
|
||||
metrics.GatewayFunctionInvocation.WithLabelValues(service).Add(1)
|
||||
|
||||
stamp := strconv.FormatInt(time.Now().Unix(), 10)
|
||||
|
||||
start := time.Now()
|
||||
@ -171,15 +173,24 @@ func main() {
|
||||
Name: "gateway_functions",
|
||||
Help: "Gateway functions",
|
||||
})
|
||||
GatewayFunctionInvocation := prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "gateway_function_invocation_total",
|
||||
Help: "Individual function metrics",
|
||||
},
|
||||
[]string{"function_name"},
|
||||
)
|
||||
|
||||
prometheus.Register(GatewayRequestsTotal)
|
||||
prometheus.Register(GatewayServerlessServedTotal)
|
||||
prometheus.Register(GatewayFunctions)
|
||||
prometheus.Register(GatewayFunctionInvocation)
|
||||
|
||||
metricsOptions := metrics.MetricOptions{
|
||||
GatewayRequestsTotal: GatewayRequestsTotal,
|
||||
GatewayServerlessServedTotal: GatewayServerlessServedTotal,
|
||||
GatewayFunctions: GatewayFunctions,
|
||||
GatewayFunctionInvocation: GatewayFunctionInvocation,
|
||||
}
|
||||
|
||||
r := mux.NewRouter()
|
||||
|
Reference in New Issue
Block a user