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

Regions Fixes #136

Closed
wants to merge 7 commits into from
Closed

Regions Fixes #136

wants to merge 7 commits into from

Conversation

sarahzinger
Copy link
Member

@sarahzinger sarahzinger commented Sep 9, 2022

Fixes #138
and
Fixes #137

Shoutout to "the mob" for joining in on this one, added some tests and found another bug to fix.

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

Backend code coverage report for PR #136

Plugin Main PR Difference
client 0.0% 0.0% 0%
datasource 73.0% 77.1% 4.1%

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

Frontend code coverage report for PR #136

Plugin Main PR Difference
src 84.21% 84.21% 0%

@sarahzinger sarahzinger changed the title Draft: Regions Fixes Regions Fixes Sep 12, 2022
@sarahzinger sarahzinger marked this pull request as ready for review September 12, 2022 23:59
@sarahzinger sarahzinger requested a review from a team as a code owner September 12, 2022 23:59
Copy link
Contributor

@sunker sunker 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! I think it would have been could if the two issues were in two different PRs if we ever needed to revert one of the two. Also makes it easier for users to understand the changelog.

Now in the ConfigEditor, the standard regions from grafana-aws-sdk-react is being used. This is not the end of the world, but it would be better to use the same list of region here as in the query editor. I think we have a few options here:

  • Spend some more time investigating if regionsForService api is available in the javascript sdk. If so, the ConnectionConfig could take "service" as a prop and then resolve regions for the service inside the component. This is nice because it would work for all our plugins, and it would also work "the first time" the config editor is loaded since it doesn't require a backend (the plugin to be saved).
  • Load regions for service from the backend. This will require some work because the first time the config editor is loaded, there's no backend because it's not saved. However, it has been solved in for example CloudWatch so should be possible to do here too.
  • Keep a hard coded, but updated, list of regions in the ConfigEditor (and pass it to ConnectionConfig).

If there's a javascript api for regionsForService, that's the best option because it would be the least amount of work for all plugins that are consuming the grafana-aws-sdk-react. But if we want to, we can go ahead and merge this PR with a hard coded (but updated) list of regions.

Thoughts?

@@ -360,6 +378,15 @@ func TestDatasource(t *testing.T) {
require.Equal(t, "graf2 (AWS2)", response.Responses["A"].Frames[0].Fields[6].At(0))
})

t.Run("getInsightSummaries query with different region", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "with different region" mean in this context? Different than the default region?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah different from the default

@sarahzinger
Copy link
Member Author

Yeah I'll break this up into 2 prs :)

Regarding updates to the config page, yeah that's interesting. I think if I recall correctly regionsForService didn't exist in the javascript sdk, but maybe there is another call with a different name that we can use. If I don't find anything I'll start looking into making a request to our backend for it.

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.

Queries seem to always use default regions Remove dependency on EC2 for regions fetching
2 participants