mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
Add HTTP status code to histogram
The histogram for gateway_functions_seconds excluded the status code that gives important information for setting up SLOs. Fixes: #1725 Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
committed by
Alex Ellis
parent
96cfdee085
commit
cc2f38938e
@ -56,16 +56,17 @@ func (p PrometheusFunctionNotifier) Notify(method string, URL string, originalUR
|
||||
}
|
||||
}
|
||||
|
||||
code := strconv.Itoa(statusCode)
|
||||
labels := prometheus.Labels{"function_name": serviceName, "code": code}
|
||||
|
||||
if event == "completed" {
|
||||
seconds := duration.Seconds()
|
||||
p.Metrics.GatewayFunctionsHistogram.
|
||||
WithLabelValues(serviceName).
|
||||
With(labels).
|
||||
Observe(seconds)
|
||||
|
||||
code := strconv.Itoa(statusCode)
|
||||
|
||||
p.Metrics.GatewayFunctionInvocation.
|
||||
With(prometheus.Labels{"function_name": serviceName, "code": code}).
|
||||
With(labels).
|
||||
Inc()
|
||||
} else if event == "started" {
|
||||
p.Metrics.GatewayFunctionInvocationStarted.WithLabelValues(serviceName).Inc()
|
||||
|
Reference in New Issue
Block a user