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

CloudMonitoring: Prevent resource type variable function from crashing #30901

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

sunker
Copy link
Contributor

@sunker sunker commented Feb 4, 2021

Fixes #30491

@sunker sunker added this to the 7.5.0 milestone Feb 4, 2021
@sunker sunker requested a review from papagian February 4, 2021 13:05
@sunker sunker requested a review from a team as a code owner February 4, 2021 13:05
@sunker sunker requested review from ying-jeanne and removed request for a team February 4, 2021 13:05
Copy link
Contributor

@papagian papagian left a comment

Choose a reason for hiding this comment

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

I think it works fine: if I select Resource Type as a query type no more crashes (but I don't get any result). If I use another cloud monitoring datasource, it still does not crashes but I get a permission denied error (I guess because I lack permission to perform such query).

@sunker sunker requested a review from a team as a code owner February 8, 2021 08:52
@sunker sunker requested review from joshhunt and removed request for a team February 8, 2021 08:52
Copy link
Contributor

@joshhunt joshhunt left a comment

Choose a reason for hiding this comment

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

looks good!

return labels['resource.type'].map(this.toFindQueryResult);
return labels.hasOwnProperty('resource.type') ? labels['resource.type'].map(this.toFindQueryResult) : [];
Copy link
Contributor

Choose a reason for hiding this comment

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

you could probably write this as labels['resource.type']?.map() ?? [] if you so cared

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I didn't mean to actually submit this comment 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes yes much better, thanks!

@sunker sunker merged commit 60b5e6c into master Feb 9, 2021
@sunker sunker deleted the fix/30491-resource-type branch February 9, 2021 08:44
ryantxu pushed a commit that referenced this pull request Feb 24, 2021
#30901)

* check if label response has resource type prop

* use nullish coalescing operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud monitoring: Unable to create new resource type template variable
3 participants