Skip to content

Commit

Permalink
Add a reference to GenerateMetricNameWithIndex()
Browse files Browse the repository at this point in the history
Signed-off-by: jorturfer <[email protected]>
  • Loading branch information
JorTurFer committed Oct 11, 2021
1 parent 2a84922 commit 108c750
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CREATE-NEW-SCALER.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ The return type of this function is `MetricSpec`, but in KEDA's case we will mos
- `TargetValue`: is the value of the metric we want to reach at all times at all costs. As long as the current metric doesn't match TargetValue, HPA will increase the number of the pods until it reaches the maximum number of pods allowed to scale to.
- `TargetAverageValue`: the value of the metric for which we require one pod to handle. e.g. if we are have a scaler based on the length of a message queue, and we specificy 10 for `TargetAverageValue`, we are saying that each pod will handle 10 messages. So if the length of the queue becomes 30, we expect that we have 3 pods in our cluster. (`TargetAverage` and `TargetValue` are mutually exclusive)

>**Note:** All scalers receive a parameter named `scalerIndex` as part of `ScalerConfig`. This value is the index of the current scaler inside the current ScaledObject. All metric names have to start with `sX-` (where `X` is scalerIndex). This convention makes the metric unique inside the ScaledObject and brings the option to have more than 1 "similar metric name" inside the same ScaledObject.
>**Note:** All scalers receive a parameter named `scalerIndex` as part of `ScalerConfig`. This value is the index of the current scaler inside the current ScaledObject. All metric names have to start with `sX-` (where `X` is scalerIndex). This convention makes the metric unique inside the ScaledObject and brings the option to have more than 1 "similar metric name" inside the same ScaledObject.
There is a naming helper function, `GenerateMetricNameWithIndex(scalerIndex int, metricName string)`, that receives the current index and the original metric name (without the prefix) and returns the concatenated string using the convention (we recommend its utilization).
For example:
>- s0-redis-mylist
>- s1-redis-mylist
Expand Down

0 comments on commit 108c750

Please sign in to comment.