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

Fix: panic in datadog scaler #3617

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Conversation

vflaux
Copy link
Contributor

@vflaux vflaux commented Aug 31, 2022

In getQueryResult(), check if the last point as a value before dereferencing it.

In the datadog scaler, returns the value of the last point with a value instead of the value of the last point.
This fixes a panic when the last point has a nil value when we try to dereference it.

Also moves duplicated code used when no metric can be found to a dedicated function.

Checklist

Fixe #3448

@vflaux vflaux requested a review from a team as a code owner August 31, 2022 10:05
@JorTurFer
Copy link
Member

JorTurFer commented Aug 31, 2022

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

@vflaux
Copy link
Contributor Author

vflaux commented Aug 31, 2022

Not sure if we should take the last point with a value (as proposed in this patch) or just return an error (or the filler value) if the last point has no value.

@JorTurFer
Copy link
Member

JorTurFer commented Aug 31, 2022

To be consistent with the already existing behaviour, could you just return an error (or the fill value)? I mean, avoiding the panic but returning 0 or fill value like in other errors

Tomorrow we will do a hotfix release, and I'd like to include this PR if you have time to change the code today

Signed-off-by: Valentin Flaux <vflaux@oui.sncf>
@JorTurFer
Copy link
Member

JorTurFer commented Aug 31, 2022

/run-e2e datadog*
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.

Thanks a ton! ❤️

@JorTurFer JorTurFer enabled auto-merge (squash) August 31, 2022 13:06
@JorTurFer JorTurFer merged commit c5d7ae6 into kedacore:main Aug 31, 2022
andyatwork pushed a commit to andyatwork/keda that referenced this pull request Oct 31, 2022
Signed-off-by: Valentin Flaux <vflaux@oui.sncf>

Signed-off-by: Valentin Flaux <vflaux@oui.sncf>
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.

2 participants