Monitoring Functions¶
Gateway¶
The Gateway component exposes several metrics to help you monitor the health and behavior of your functions
Metric | Type | Description | Labels | Edition |
---|---|---|---|---|
gateway_functions_seconds |
histogram | Function invocation time taken | function_name |
Community Edition |
gateway_function_invocation_total |
counter | Function invocation count | function_name , code |
Community Edition |
gateway_service_count |
counter | Number of function replicas | function_name |
Community Edition |
gateway_service_target |
gauge | Target load for the function | function_name |
Pro Edition |
gateway_service_min |
gauge | Min number of function replicas | function_name |
Pro Edition |
http_request_duration_seconds |
histogram | Seconds spent serving HTTP requests | method , path , status |
Community Edition |
http_requests_total |
counter | The total number of HTTP requests | method , path , status |
Community Edition |
http_requests_total |
counter | The total number of HTTP requests | method , path , status |
Community Edition |
The http_request*
metrics record the latency and statistics of /system/*
routes to monitor the OpenFaaS gateway and its provider. The /async-function
route is also recorded in these metrics to observe asynchronous ingestion rate and latency.
Examples¶
These basic metrics can be used to track the health of your functions as well a general usage patterns. See the Prometheus documentation and examples for more details about the available options and query functions. Below are several queries you might want to include in a basic Grafana dashboard for observing your OpenFaaS functions
Function invocation rate¶
Return the per-second rate of invocation as measured over the previous 1 minute:
rate ( gateway_function_invocation_total [1m])
Function replica count / scaling¶
Return the total function replicas:
gateway_service_count
Total OK Function Invocation¶
Return the total number of successful function invocations:
sum( gateway_function_invocation_total { code=\"200\"}
Function execution time¶
Return the average function execution time, as measure over the previous 20 seconds:
(rate(gateway_functions_seconds_sum[20s]) / rate(gateway_functions_seconds_count[20s]))
Metrics for a single function¶
Each of the metrics generated by the Gateway are labeled with and can be filtered by the function name, For example The invocation rate for just a single function (e.g. if the function name is echo
) is given by
rate ( gateway_function_invocation_total{function_name='echo'} [20s])
Watchdog¶
The classic and of-watchdog both provide Prometheus instrumentation on TCP port 8081 on the path /metrics. This is to enable the use-case of HPAv2 from the Kubernetes ecosystem.
Metric | Type | Description | Labels | Edition |
---|---|---|---|---|
http_request_duration_seconds |
histogram | Seconds spent serving HTTP requests | method , path , status |
Community Edition |
http_requests_total |
counter | The total number of HTTP requests | method , path , status |
Community Edition |
http_requests_in_flight |
gauge | The number of HTTP requests in flight | method , path , status |
Pro Edition |
Provider¶
The FaaS Provider is the back-end API used by other OpenFaaS components like the Gateway. It exposes several metrics.
Metric | Type | Description | Labels | Edition |
---|---|---|---|---|
provider_http_request_duration_seconds |
histogram | Seconds spent serving HTTP requests | method , path , code |
Community Edition |
provider_http_requests_total |
counter | The total number of HTTP requests | method , path , code |
Community Edition |
The http_request*
metrics record the latency and statistics of /system/*
routes. Part of this information is also recorded in the metrics for the Gateway component. The purpose of exposing separate metrics on the provider component is to show the count of calls, to show efficiency, and to show the duration for performance testing, along with errors to flag unseen issues.