You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2024-08-22-custom-metrics-scaling.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,10 @@ The first half `ceil(sum(irate ( pod_cpu_usage_seconds_total{}[1m])*1000) by (fu
70
70
71
71
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`.
72
72
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
+
73
77
### 3. Set the scaling type on your function
74
78
75
79
Here is a redacted example of how a function can target the `cpu` recording rule:
0 commit comments