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
CloudWatch: Fix - make sure dimensions are propagated to alert query editor #58281
CloudWatch: Fix - make sure dimensions are propagated to alert query editor #58281
Conversation
Signed-off-by: Conor Evans <coevans@tcd.ie>
Thanks a lot for reporting this issue and proposing a solution @conorevans! I wonder if the problem can be solved with a different approach though. The alerting engine doesn't support template variables, so before the alerting UI is loaded, it calls Thanks again! |
Hi @sunker thanks for the review and pointing me in a helpful direction! Yeah there's quite the chaining happening here, makes for some gnarly debugging 😅 (esp as I'm no TS whiz). I've implemented your feedback and it looks cleaner + set properly closer to source than my original tack. Please feel free to suggest any changes or apply them yourself. Cheers |
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.
Thanks! Added a few comments. Also, would you be able to add a test for the interpolateVariablesInQueries
method? There's already a pattern for testing this method here in the datasource test file. If you could add a scenario with something like should not change structure of dimension prop if its not a template variable
, that would be great!
public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts
Outdated
Show resolved
Hide resolved
public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts
Outdated
Show resolved
Hide resolved
@sunker implemented that batch of feedback! I tried to add a test via a few different permutations but I could not find a satisfactory way of accessing the dimensions of the interpolated queries. Do you mind taking a look? I'm happy for you to push to my PR |
Test added! |
Thank you 😄 |
Sorry didn't realise that requesting re-review from @sunker would remove request for review from @iwysiu and @kevinwcyu |
@conorevans I'll look into the failing tests as soon as I can! |
8dbd485
to
0488fbb
Compare
Sorry @conorevans, dropped the ball on this PR for a while. The path that I suggested in this PR, making changes to datasource.interpolateVariablesInQuery, had side effects that there are not easy fixes for. I rebased and removed all commits except for the first one, which includes you initial fix. Also added a unit test. Thanks a lot for contributing and again sorry for the delay! |
…rt query editor (#59933) CloudWatch: Fix - make sure dimensions are propagated to alert query editor (#58281) * fix(unified-alerting/cloudwatch): propagate dimensions to alert Signed-off-by: Conor Evans <coevans@tcd.ie> * add unit test Signed-off-by: Conor Evans <coevans@tcd.ie> Co-authored-by: Erik Sundell <erik.sundell87@gmail.com> (cherry picked from commit dce7f50) Co-authored-by: Conor Evans <43791257+conorevans@users.noreply.github.com>
All okay @sunker ! Thanks for your efforts |
…rt query editor (grafana#59933) CloudWatch: Fix - make sure dimensions are propagated to alert query editor (grafana#58281) * fix(unified-alerting/cloudwatch): propagate dimensions to alert Signed-off-by: Conor Evans <coevans@tcd.ie> * add unit test Signed-off-by: Conor Evans <coevans@tcd.ie> Co-authored-by: Erik Sundell <erik.sundell87@gmail.com> (cherry picked from commit dce7f50) Co-authored-by: Conor Evans <43791257+conorevans@users.noreply.github.com>
Signed-off-by: Conor Evans coevans@tcd.ie
Which issue(s) does this PR fix?:
Fixes #58280
Special notes for your reviewer:
I'm not sure if Cloudwatch can return
string
s as the value for Dimensions. From what I can see, they're always arrays with a single string. However, I've kept the existing code in place and just modified it to account for that latter case.Before:
grafana_latest_bug.mov
After:
grafana_local_fixed.mov