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 AWS Cloudwatch Scaler metric exporting logic #2243

Merged
merged 7 commits into from
Nov 4, 2021

Conversation

fivesheep
Copy link
Contributor

@fivesheep fivesheep commented Nov 1, 2021

Signed-off-by: Xiayang Wu xwu@rippling.com

Provide a description of what has been changed
To address the issues mentioned in #2242

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO - learn more)
  • Tests have been added
  • A PR is opened to update our Helm chart (repo) (if applicable, ie. when deployment manifests are modified)
  • A PR is opened to update the documentation on update aws cloudwatch scaler doc keda-docs#568
  • Changelog has been updated

Fixes #

  • Truncate/Round down the endtime based on the metrics period setting to provide better performance and avoid getting empty data
  • startTime to be based on the endTime(to avoid two time.now() calls)
  • Add a new param named metricEndTimeOffset to allow skipping the most recent data point from cloudwatch
  • Add a new param named metricUnit to allow passing a metric Unit which is needed by some metrics

Signed-off-by: Xiayang Wu <xwu@rippling.com>
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.

Generally seems to be ok, could you please add unit tests for the new functionality and modify documentation on kedacore/keda-docs? Thanks

Signed-off-by: Xiayang Wu <xwu@rippling.com>
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 a ton for the changes :)

@zroubalik
Copy link
Member

Could you please update docs and fix the linter problems? https://github.com/kedacore/keda/runs/4089628384?check_suite_focus=true

Signed-off-by: Xiayang Wu <xwu@rippling.com>
@zroubalik
Copy link
Member

@fivesheep fyi you can run the static check locally if you configur precommit or you can run make golangci. This should help you tackling the linter problems.

Signed-off-by: Xiayang Wu <xwu@rippling.com>
Signed-off-by: Xiayang Wu <xwu@rippling.com>
Signed-off-by: Xiayang Wu <xwu@rippling.com>
@fivesheep
Copy link
Contributor Author

@JorTurFer a couple more changes were made to fix the linting issue. need to introduce two helper function to reduce the number of if-elses, please review again. thx!

@JorTurFer
Copy link
Member

LGTM!
Let's wait until the validations are finished to check that all is good.
BTW, thanks a ton for your effort updating this AWS scaler! ❤️ ❤️

pkg/scalers/aws_cloudwatch_scaler.go Outdated Show resolved Hide resolved
@JorTurFer
Copy link
Member

JorTurFer commented Nov 3, 2021

One more thing, could you update the CHANGELOG please?
I have just seen that you didn't update it

Signed-off-by: Xiayang Wu <xwu@rippling.com>
@fivesheep
Copy link
Contributor Author

There's a timeout on the failed check, not sure how to re-trigger it

@JorTurFer
Copy link
Member

Thanks! :)
Maybe @zroubalik could re-execute it. Let's wait until he has time

@zroubalik
Copy link
Member

Once comments on doc PR are resolved we can merge this :)

@zroubalik zroubalik changed the title improve aws cloudwatch scaler metrics pulling logic Improve AWS Cloudwatch Scaler metric exporting logic Nov 4, 2021
@zroubalik zroubalik merged commit b6fde28 into kedacore:main Nov 4, 2021
@zroubalik
Copy link
Member

Thanks a lot for the contribution!

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