Skip to content

Commit ae72a38

Browse files
committed
Explain how to edit/update recording rules
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent a19a25a commit ae72a38

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

_posts/2024-08-22-custom-metrics-scaling.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ The first half `ceil(sum(irate ( pod_cpu_usage_seconds_total{}[1m])*1000) by (fu
7070

7171
The second half: `* on (function_name) avg by (function_name) (gateway_service_target_load{scaling_type="cpu"} > bool 1` is an optimisation which means this rule is only evaluated when a function has a label set of `com.openfaas.scaling.type: cpu`.
7272

73+
You can set recording rules permanently [by editing values.yaml](https://docs.openfaas.com/architecture/autoscaling/#custom-autoscaling-rules), or insert them temporarily by running `kubectl edit -n openfaas configmap/prometheus-config` followed by `kubectl rollout restart -n openfaas deploy/prometheus`.
74+
75+
Bear in mind that if you're port-forwarding Prometheus to your local machine, you will need to terminate the command and to run it again after the new version of the Pod is available.
76+
7377
### 3. Set the scaling type on your function
7478

7579
Here is a redacted example of how a function can target the `cpu` recording rule:

0 commit comments

Comments
 (0)