mirror of
https://github.com/openfaas/faas.git
synced 2025-06-30 13:23:35 +00:00
@ -7,6 +7,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/openfaas/faas/gateway/requests"
|
"github.com/openfaas/faas/gateway/requests"
|
||||||
@ -56,8 +57,8 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
// log.Printf("Querying Prometheus API\n")
|
// log.Printf("Querying Prometheus API\n")
|
||||||
// `sum(gateway_function_invocation_total{function_name=~".*", code=~".*"}) by (function_name, code)`)
|
expr := url.QueryEscape(`sum(gateway_function_invocation_total{function_name=~".*", code=~".*"}) by (function_name, code)`)
|
||||||
expr := "sum(gateway_function_invocation_total%7Bfunction_name%3D~%22.*%22%2C+code%3D~%22.*%22%7D)+by+(function_name%2C+code)"
|
// expr := "sum(gateway_function_invocation_total%7Bfunction_name%3D~%22.*%22%2C+code%3D~%22.*%22%7D)+by+(function_name%2C+code)"
|
||||||
results, fetchErr := prometheusQuery.Fetch(expr)
|
results, fetchErr := prometheusQuery.Fetch(expr)
|
||||||
if fetchErr != nil {
|
if fetchErr != nil {
|
||||||
log.Printf("Error querying Prometheus API: %s\n", fetchErr.Error())
|
log.Printf("Error querying Prometheus API: %s\n", fetchErr.Error())
|
||||||
|
Reference in New Issue
Block a user