Keda: [Proposal] Use unique name for metricName for each scaler

Created on 8 Apr 2020  路  14Comments  路  Source: kedacore/keda

Currently metric name is hard coded to a specific value (see the example on Kafka scaler), this applies to most of the scalers. Metric name is essential for Metric server and HPA as it is used to distiguish the correct metrics used for scaling.

If we define two or more scalers of the same kind in one ScaledObject, scaling won't be correct as all the scalers will share the same metric name, eg. for Kafka it would be lagThreshold. This could be even problem when using specific combination fo different scalers, as they are using same metric name, eg. Kafka and Stan and probably some others as well.

Using multiple scalers of different kind (or same kind but with different metrics) in one ScaledObject is working: https://github.com/kedacore/keda/issues/702

If we want to support multiple scalers, we will need to do modification in every scaler. Each scaler would have to use unique metric name, it's up for discussion what approach would be the best, some of the possibilities are:

  • generate unique string
  • add unique preffix/suffix to the metric name
  • generate unique string/prefix/suffix only if there are mutliple scalers in ScaledObject (to keep the same metric name for the scalers that we have in v1)
  • enforce users to set name in trigger metadata in case they will specify more than one scaler in ScaledObject

Use-Case

There could be multiple scalers of the same kind in ScaledObject

Discussion

  • Do we want this feature for v2?
  • What is the best way to define metric name?

//EDIT added note about Kafka + Stan scalers

feature

Most helpful comment

Yeah, but we should bear in mind that the generator must be idempotent, provide the same "unique" value for the same trigger.

All 14 comments

Let's enforce this as of v2.0; think this is a good point of improvement!

add unique preffix/suffix to the metric name

I would go for this as it's consistent across scalers & scenario which we can use in our logging as well

I think having an optional parameter to provide a unique name . if it's not found then we can generate the unique name based on the parameters for the scalar.

That's a good suggestion imo!

Yeah, but we should bear in mind that the generator must be idempotent, provide the same "unique" value for the same trigger.

yes. i think we can generate it based on the parameters provided. for example : kafka-scalar-> "kafka-topic-group"

@AmithGanesh are you volunteering to implement this? 馃槃

yes. i would like to take this up

@AmithGanesh what is the status of this please?

Almost done. will submit a Pull Request by the end of the week.

@AmithGanesh that's great! You might want to share your progress on a meeting this Thursday :)

@AmithGanesh any update on this?

@samuelmacko agreed to finish this

Solved in #966

Was this page helpful?
0 / 5 - 0 ratings