Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding custom recording rules. #1225

Closed
wants to merge 1 commit into from

Conversation

welteki
Copy link
Member

@welteki welteki commented Aug 23, 2024

Description

Support adding custom autoscaling recording rules through the OpenFaaS Helm chart.

Parameter Description Default
prometheus.recordingRules Custom recording rules for autoscaling. []

Why is this needed?

  • I have raised an issue to propose this change (required)

Prevent users from having to fork and modify the chart to start using custom autoscaling rules.

Who is this for?

What company is this for? Are you listed in the ADOPTERS.md file?

How Has This Been Tested?

Used helm template to verify the Prometheus config templates works with and without custom rules.

values.yml:

prometheus:
  recordingRules:
    - record: job:function_current_load:sum
      expr: |
        sum by (function_name) (rate(gateway_functions_seconds_sum{}[30s])) / sum by (function_name)  (rate( gateway_functions_seconds_count{}[30s]))
        and on (function_name) avg by(function_name) (gateway_service_target_load{scaling_type="latency"}) > bool 1
      labels:
        scaling_type: latency
    
    - record: job:function_current_load:sum
       expr: |
        ceil(sum by (function_name) (max_over_time(pod_memory_working_set_bytes[45s:5s]))
        * on (function_name) avg by (function_name) (gateway_service_target_load{scaling_type="memory"} > bool 1))
      labels:
        scaling_type: memory

Without custom rules:

helm template chart/openfaas  \
  --namespace openfaas  \
  -s templates/prometheus-pro-cfg.yaml

With custom rules:

helm template chart/openfaas  \
  --namespace openfaas  \
  --values ./values.yaml \
  -s templates/prometheus-pro-cfg.yaml

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alexellis
Copy link
Member

alexellis commented Aug 27, 2024

These are not autoscalingRules, but recordingRules. Could you update the section?

Since there is no example in the docs, how important is tabbing/indent?

I think this may this cause confusion for customers, so can you create a PR for the docs on the autoscaling page and also link back to the blog post from there.

@alexellis alexellis self-requested a review August 27, 2024 13:17
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the notes

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
@alexellis alexellis closed this in 0e4465d Aug 27, 2024
@welteki welteki changed the title Support adding custom autoscaling rules. Support adding custom recording rules. Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants