cpchung
cpchung

Reputation: 844

How to define a HPA rule for a custom metric of fractional value?

I have a custom metric which is a state metric of fractional value. It is ranged from 0 to 1, e.g. memory utilization, 1 means it is fully utilized. How can we write its HPA yaml file?

I see there is an example showing how to write the yaml file for an integer value over a period of time. How can we modify this for a fractional value?

rules:
  custom:
    - seriesQuery: 'http_requests_total{namespace!="",pod!=""}'
      resources:
        overrides:
          namespace: {resource: "namespace"}
          pod: {resource: "pod"}
      name:
        matches: "^(.*)_total"
        as: "${1}_per_second"
      metricsQuery: 'sum(rate(<<.Series>>{<<.LabelMatchers>>}[2m])) by (<<.GroupBy>>)'

Upvotes: 0

Views: 53

Answers (0)

Related Questions