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

Add AWS support to up spaces billing get #347

Merged
merged 3 commits into from
Aug 8, 2023
Merged

Conversation

nlinx
Copy link
Contributor

@nlinx nlinx commented Aug 7, 2023

Description of your changes

  • Adds AWS support to up spaces billing get

Fixes #
https://github.com/upbound/mxe/issues/143
I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

  • Unit tests for clientutil functions
  • Manual testing against Upbound test bucket with usage data within it

@Upbound-CLA
Copy link

Upbound-CLA commented Aug 7, 2023

CLA assistant check
All committers have signed the CLA.

@nlinx nlinx force-pushed the spacesAWS branch 3 times, most recently from 6ded32b to a9b5468 Compare August 7, 2023 19:05
@nlinx nlinx requested a review from branden August 7, 2023 19:10
@nlinx nlinx changed the title wip Add AWS support to up spaces billing get Aug 7, 2023
@nlinx nlinx marked this pull request as ready for review August 7, 2023 19:10
Copy link
Contributor

@branden branden left a comment

Choose a reason for hiding this comment

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

Thanks @nlinx! I left some comments, I think there might be bugs regarding storage queries and download concurrency. But they look quite fixable, this looks close.

cmd/up/space/billing/get.go Outdated Show resolved Hide resolved
@@ -168,7 +174,7 @@ func (c *getCmd) cleanupOnError() {
}
}

func (c *getCmd) collectReport() error {
func (c *getCmd) collectReport() error { //nolint:gocyclo
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this method be refactored so that it isn't hitting the cyclomatic complexity limit? The switch or its cases look like a juicy target for factoring out into a separate method.

Copy link
Contributor

Choose a reason for hiding this comment

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

Bump, let's refactor this method instead of silencing the gocyclo linter on it.

internal/usage/report/aws/aws.go Show resolved Hide resolved
internal/usage/report/aws/aws.go Outdated Show resolved Hide resolved
internal/usage/report/aws/aws.go Outdated Show resolved Hide resolved
@nlinx nlinx force-pushed the spacesAWS branch 3 times, most recently from ef3cf6e to fdc3b15 Compare August 8, 2023 17:46
Copy link
Contributor

@branden branden left a comment

Choose a reason for hiding this comment

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

This LGTM, there's just one lint error that I think we should address rather than silencing it.

@@ -168,7 +174,7 @@ func (c *getCmd) cleanupOnError() {
}
}

func (c *getCmd) collectReport() error {
func (c *getCmd) collectReport() error { //nolint:gocyclo
Copy link
Contributor

Choose a reason for hiding this comment

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

Bump, let's refactor this method instead of silencing the gocyclo linter on it.

@nlinx nlinx requested a review from branden August 8, 2023 19:13
@@ -39,10 +41,27 @@ const (
errWriteEvents = "error writing events"
)

// MaxResourceCountPerGVKPerMCP reads usage data for an account and time range
// GenerateReport
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Incomplete docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol that's what i get for stepping away to eat while writing doc string

@@ -40,10 +41,29 @@ const (
errWriteEvents = "error writing events"
)

// MaxResourceCountPerGVKPerMCP reads usage data for an account and time range
func GenerateReport(ctx context.Context, account, endpoint, bucket string, billingPeriod usage.TimeRange, w report.MCPGVKEventWriter) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: No docstring

Comment on lines 22 to 23
"cloud.google.com/go/storage"

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: cloud.google.com/go/storage should be grouped with the other third-party imports below.

@nlinx nlinx merged commit 91a758e into upbound:main Aug 8, 2023
6 checks passed
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.

None yet

4 participants