-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Conversation
There was a problem hiding this 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).
b7aefca
to
696b166
Compare
There was a problem hiding this 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) : []; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 😅
There was a problem hiding this comment.
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!
#30901) * check if label response has resource type prop * use nullish coalescing operator
Fixes #30491