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

Deprecate explicitly setting metricName for all scalers #4235

Merged
merged 7 commits into from
Feb 27, 2023
Merged

Deprecate explicitly setting metricName for all scalers #4235

merged 7 commits into from
Feb 27, 2023

Conversation

yardenshoham
Copy link
Contributor

@yardenshoham yardenshoham commented Feb 13, 2023

In v2.12 this setting will be internalized and should not be set by users

A log message was added

Checklist

Docs PR kedacore/keda-docs#1074
Relates to #4220

@yardenshoham yardenshoham requested a review from a team as a code owner February 13, 2023 18:24
Copy link
Member

@JorTurFer JorTurFer 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 a good idea, but sadly we cannot do it at this level because there are some scalers where metricName is a valid value used in the scaler (like aws cloudwatch). We need to do it one by one

@zroubalik
Copy link
Member

This is a good idea, but sadly we cannot do it at this level because there are some scalers where metricName is a valid value used in the scaler (like aws cloudwatch). We need to do it one by one

If aws cloudwatch is the only one, then we can probably add the exception to the code added in this PR. Or is there any other scaler where metricName is valid?

@JorTurFer
Copy link
Member

I'm not 100% sure, I haven't had time to check it in depth yet

@zroubalik
Copy link
Member

@yardenshoham could you please check the source code of scalers that uses metricName to verify that it is being used only for internal metrics representation?

For example:

metricName string

vs
metricsName string

@yardenshoham
Copy link
Contributor Author

Will do, tonight

@JorTurFer
Copy link
Member

JorTurFer commented Feb 14, 2023

Also remember that this doesn't solve all the cases. I mean, this adds the warning notification to all at once (which is nice), but scalers like prometheus requires metricName, they need to be updated to make it optional too

@yardenshoham
Copy link
Contributor Author

Yes, I didn't claim this would resolve the issue

@JorTurFer
Copy link
Member

JorTurFer commented Feb 14, 2023

Yeah, I know it, I said just to share the point. Maybe we can fix them as part of this PR if there are only a few. I mean, if only 1-3 scalers require changes, we could do it in one shoot
Wdyt?

@yardenshoham
Copy link
Contributor Author

I think it's a good idea. For prometheus, how about I normalize the query and set that as queryName?

@JorTurFer
Copy link
Member

I think it's a good idea. For prometheus, how about I normalize the query and set that as queryName?

I think it's not necessary, adding a fixed value like 'prometheus' is more than enough as this is an internal value. Something like
If given value, warning and use it
If not given, use something like 'prometheus'

And please, add a comment in scalers where the metricName should be removed or write them somewhere to have them tracked for removing them 🙏

@yardenshoham
Copy link
Contributor Author

So meta.metricName need not be unique?

@JorTurFer
Copy link
Member

JorTurFer commented Feb 14, 2023

So meta.metricName need not be unique?

No, it isn't required since we introduced a dynamic prefix. Each metric has sX- as a prefix where X is the scaler index, so even if you use the same name for all the cases, the metric name will be unique in the scaled object because it's based on the scaler index

@yardenshoham
Copy link
Contributor Author

Two scalers stand out:

  • aws-cloudwatch
  • huawei-cloudeye

How should I handle them?

Deprecate explicitly setting `metricName` field from `ScaledObject.triggers[*].metadata`

In v2.12 this setting will be internalized and should not be set by users

A log message was added, as well as code comments

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
@yardenshoham yardenshoham changed the title General: Log explicitly setting metricName for all scalers is deprecated General: Deprecate explicitly setting metricName for all scalers Feb 14, 2023
@JorTurFer
Copy link
Member

How should I handle them?

As they are just 2, maybe we can add them in the if to ignore them for the warning. WDYT?

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
@yardenshoham
Copy link
Contributor Author

Sounds good, done

@JorTurFer
Copy link
Member

JorTurFer commented Feb 17, 2023

/run-e2e
Update: You can check the progress here

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the improvement ❤️
Could you update docs as well?

@JorTurFer
Copy link
Member

PTAL @zroubalik

@yardenshoham
Copy link
Contributor Author

Could you update docs as well?

Sure, I'll get started as soon as this PR lands

@yardenshoham
Copy link
Contributor Author

Should I keep updating this PR?

@zroubalik
Copy link
Member

zroubalik commented Feb 21, 2023

/run-e2e
Update: You can check the progress here

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.

LGTM, great job!

@yardenshoham could you please open a docs PR. We require to have approved docs PR before merging code PR. Thanks a lot

@zroubalik
Copy link
Member

Should I keep updating this PR?

It is fine as it now, thanks! :)

@yardenshoham
Copy link
Contributor Author

yardenshoham commented Feb 21, 2023

Great! Docs PR will be ready tomorrow today

@yardenshoham
Copy link
Contributor Author

Docs PR kedacore/keda-docs#1074

@yardenshoham yardenshoham changed the title General: Deprecate explicitly setting metricName for all scalers Deprecate explicitly setting metricName for all scalers Feb 21, 2023
@zroubalik
Copy link
Member

Docs PR kedacore/keda-docs#1074

awesome, could you please track tasks in the issue #4220 ? In the issue describtion there's TODO list

@yardenshoham
Copy link
Contributor Author

Apart from creating the discussion, what are the other action items? Not sure what needs to be done in "update documentation to specify deprecation notice"

@zroubalik
Copy link
Member

Apart from creating the discussion, what are the other action items? Not sure what needs to be done in "update documentation to specify deprecation notice"

exactly this PR you did: kedacore/keda-docs#1074 :)

Just link it in the tasks in the issue and mark this item as done :)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
@yardenshoham
Copy link
Contributor Author

I commented #4220 (comment)

@zroubalik
Copy link
Member

zroubalik commented Feb 24, 2023

I commented #4220 (comment)

I mean the todo list, but I've just realized you probably can't modify that, right?

@yardenshoham
Copy link
Contributor Author

Correct

@yardenshoham
Copy link
Contributor Author

Is there any more work to get this PR merged? It has 2 approvals

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.

Thanks a lot for the contribution @yardenshoham !

@zroubalik zroubalik merged commit 2cef285 into kedacore:main Feb 27, 2023
@yardenshoham yardenshoham deleted the deprecate-metric-name branch February 27, 2023 08:23
xoanmm pushed a commit to xoanmm/keda that referenced this pull request Mar 22, 2023
)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
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.

3 participants