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

Improve metric name creation to be unique using scaler index inside the scaler #2161

Merged
merged 11 commits into from
Oct 13, 2021

Conversation

JorTurFer
Copy link
Member

@JorTurFer JorTurFer commented Oct 5, 2021

Signed-off-by: jorturfer jorge_turrado@hotmail.es

This draft shows the approach of using the scaler index as a prefix to ensure all metric names are unique in the ScaledObject during the scaler constructor. All the metric names will be composed using the pattern sX-currentMetricName where x is the index.

Checklist

Fixes #2123

@JorTurFer JorTurFer force-pushed the unique_names_index_in_scaler branch 2 times, most recently from cafcbc3 to 6d697e4 Compare October 10, 2021 11:36
@JorTurFer JorTurFer marked this pull request as ready for review October 10, 2021 15:49
@JorTurFer JorTurFer force-pushed the unique_names_index_in_scaler branch from 2b43756 to 07abff3 Compare October 10, 2021 15:54
@JorTurFer JorTurFer changed the title WIP - Improve metric name creation to be unique using scaler index inside the scaler Improve metric name creation to be unique using scaler index inside the scaler Oct 10, 2021
@JorTurFer JorTurFer changed the title Improve metric name creation to be unique using scaler index inside the scaler WIP - Improve metric name creation to be unique using scaler index inside the scaler Oct 10, 2021
@JorTurFer
Copy link
Member Author

JorTurFer commented Oct 10, 2021

Could you execute e2e test using this branch? I have tried several of them, but to be sure that they are working (and I don't have accounts to test all of them)

@JorTurFer JorTurFer changed the title WIP - Improve metric name creation to be unique using scaler index inside the scaler Improve metric name creation to be unique using scaler index inside the scaler Oct 10, 2021
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

This is great!

CREATE-NEW-SCALER.md Outdated Show resolved Hide resolved
@zroubalik
Copy link
Member

zroubalik commented Oct 11, 2021

We should have to go through the documentation and fix the example metric names (to include sX- prefix) on some scalers.

@JorTurFer
Copy link
Member Author

We should have to go through the documentation and fix the example metric names (to include sX- prefix) on some scalers.

Ouch, I didn't think on that... I will review them but I think that the change is totally internal. I mean, if a user specify the metricName (ex, on postgresql), the external metric name will be sX-userMetricName.
We use index always.

I will check it and probably we should add a note also in docs to refer this change. From KEDA pov is not important because the hpa will be recreated, but maybe some users are quering the metric directly and this could ba a breaking change.
WDYT? Should we add a new section there?

@zroubalik
Copy link
Member

We should have to go through the documentation and fix the example metric names (to include sX- prefix) on some scalers.

Ouch, I didn't think on that... I will review them but I think that the change is totally internal. I mean, if a user specify the metricName (ex, on postgresql), the external metric name will be sX-userMetricName. We use index always.

There are examples of the generated metric names in some scalers. For example here: https://keda.sh/docs/2.4/scalers/mongodb/ find on the page occurencies of mongodb-mongodb—test_user-test_password@xxx-27017-test-test_collection

I will check it and probably we should add a note also in docs to refer this change. From KEDA pov is not important because the hpa will be recreated, but maybe some users are quering the metric directly and this could ba a breaking change. WDYT? Should we add a new section there?

Yeah probably a section on HPA and metrics would be fine, with addition:

@JorTurFer
Copy link
Member Author

We should have to go through the documentation and fix the example metric names (to include sX- prefix) on some scalers.

Ouch, I didn't think on that... I will review them but I think that the change is totally internal. I mean, if a user specify the metricName (ex, on postgresql), the external metric name will be sX-userMetricName. We use index always.

There are examples of the generated metric names in some scalers. For example here: https://keda.sh/docs/2.4/scalers/mongodb/ find on the page occurencies of mongodb-mongodb—test_user-test_password@xxx-27017-test-test_collection

I will check it and probably we should add a note also in docs to refer this change. From KEDA pov is not important because the hpa will be recreated, but maybe some users are quering the metric directly and this could ba a breaking change. WDYT? Should we add a new section there?

Yeah probably a section on HPA and metrics would be fine, with addition:

I will do it ASAP, after the netcoreconf last weekend, I have to earn "family points" xD.
I'l try to do at night

@zroubalik
Copy link
Member

@JorTurFer oh boy :) no rush at all, family first.

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

Looking good, just nits

CREATE-NEW-SCALER.md Outdated Show resolved Hide resolved
CREATE-NEW-SCALER.md Outdated Show resolved Hide resolved
@zroubalik
Copy link
Member

Looking good, the only thing I am not sure are potential consequences for External scaler, @ahmelsayed wdyt?

@JorTurFer
Copy link
Member Author

JorTurFer commented Oct 11, 2021

Looking good, the only thing I am not sure are potential consequences for External scaler, @ahmelsayed wdyt?

Maybe we could let external scaler as it was before this change and delegate to the user to avoid collisions here 🤔

@zroubalik (IDK how you edited my comment xD):
Yeah, I meant whether there is needed some changes in external scaler docs and whatnot.

CREATE-NEW-SCALER.md Outdated Show resolved Hide resolved
pkg/scalers/metrics_api_scaler_test.go Show resolved Hide resolved
Jorge Turrado and others added 7 commits October 13, 2021 10:54
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: jorturfer <jorge_turrado@hotmail.es>
…calers

Signed-off-by: jorturfer <jorge_turrado@hotmail.es>
Signed-off-by: jorturfer <jorge_turrado@hotmail.es>
Signed-off-by: jorturfer <jorge_turrado@hotmail.es>
@JorTurFer JorTurFer force-pushed the unique_names_index_in_scaler branch from 58ef90f to 2ab64a6 Compare October 13, 2021 08:56
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Jorge Turrado added 2 commits October 13, 2021 11:19
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
@zroubalik zroubalik merged commit 17a380c into kedacore:main Oct 13, 2021
@JorTurFer JorTurFer deleted the unique_names_index_in_scaler branch October 13, 2021 10:05
nilayasiktoprak pushed a commit to nilayasiktoprak/keda that referenced this pull request Oct 23, 2021
…he scaler (kedacore#2161)

Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
Signed-off-by: nilayasiktoprak <nilayasiktoprak@gmail.com>
@zroubalik zroubalik mentioned this pull request Oct 25, 2021
4 tasks
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.

Improve metric name creation to be unique
3 participants