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

feat: log metrics to github-workflows account #2613

Merged
merged 5 commits into from
Sep 21, 2022
Merged

Conversation

0618
Copy link
Contributor

@0618 0618 commented Sep 20, 2022

Description of changes

This PR is one of the steps to migrate Github Workflow related resources from aws-amplify-ui@ to aws-amplify-ui+github-workflows@.

  • create github-actions-metric-logger user and get credentials
  • add credentials to github secrets
  • this PR. use the metric-logger credentials to log metrics in github-worflows account
  • create alarms in github-worflows account
  • remove log-success/failure-metric-prod
  • remove alarms/metrics from aws-amplify-ui@

Issue #, if available

Description of how you validated changes

Tested in the PoC workflow https://github.com/aws-amplify/amplify-ui/actions/runs/3095070222/jobs/5009138998

PoC branch https://github.com/aws-amplify/amplify-ui/tree/poc/gh-workflow/metric-logger-cred

Checklist

  • PR description included
  • yarn test passes
  • Tests are updated
  • No side effects or sideEffects field updated
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0618 0618 requested a review from a team as a code owner September 20, 2022 19:14
@changeset-bot
Copy link

changeset-bot bot commented Sep 20, 2022

⚠️ No Changeset found

Latest commit: 7fff2f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@0618 0618 force-pushed the add-new-metric-logger branch from bf820e0 to 77bc7c8 Compare September 20, 2022 19:24
Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>
@0618 0618 force-pushed the add-new-metric-logger branch from ee5e645 to 0543f8f Compare September 20, 2022 19:37
@0618 0618 temporarily deployed to ci September 20, 2022 19:50 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 19:50 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 19:50 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 19:50 Inactive
@aws-amplify aws-amplify deleted a comment from 0618 Sep 20, 2022
@aws-amplify aws-amplify deleted a comment from 0618 Sep 20, 2022
Copy link
Contributor

@wlee221 wlee221 left a comment

Choose a reason for hiding this comment

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

One last typo nit, but lgtm otherwise

# Send data point 0 to metric PublishLatestFailure, if it's a success
log-success-metric-prod:
# to be deprecated once log-success-metric is up
# Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success
# Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching! Fixed them all

@@ -177,3 +180,39 @@ jobs:
value: 0
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1

log-failure-metric:
Copy link
Contributor

Choose a reason for hiding this comment

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

Eventually, I think we can abstract log-failure-metric and log-success metric.

Maybe some input like this:

with:
  status: 'success' | 'failure'
  successValue: 0 # Optional, will not send anything if not supplied
  failureValue: 1 # Optional, will not send anything if not supplied
  ...

Copy link
Contributor

@wlee221 wlee221 Sep 20, 2022

Choose a reason for hiding this comment

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

But I'm good as-is now to keep change surface area low.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Just consolidated them into 1 action

Copy link
Contributor

Choose a reason for hiding this comment

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

Ooh, I was talking about refactoring the action itself (sorry if it wasn't clear). But I like what you have!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was clear and I thought about changing the action, but I think this way we can keep the action flexible so that potentially we can log different values beyond successValue and failureValue 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

Sgtm!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

failure() doesn't work outside if:, so I had to give up using that way ☹️

Copy link
Contributor

Choose a reason for hiding this comment

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

Good thing we did a poc test 😈

wlee221
wlee221 previously approved these changes Sep 20, 2022
Copy link
Contributor

@wlee221 wlee221 left a comment

Choose a reason for hiding this comment

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

Just one more spacing nit, but lgtm!

wlee221
wlee221 previously approved these changes Sep 20, 2022
@0618 0618 temporarily deployed to ci September 20, 2022 21:10 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 21:10 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 21:10 Inactive
@0618 0618 temporarily deployed to ci September 20, 2022 21:10 Inactive
@0618 0618 temporarily deployed to ci September 21, 2022 05:09 Inactive
@0618 0618 temporarily deployed to ci September 21, 2022 05:10 Inactive
@0618 0618 temporarily deployed to ci September 21, 2022 05:10 Inactive
@0618 0618 temporarily deployed to ci September 21, 2022 05:10 Inactive
@0618 0618 merged commit c701e21 into main Sep 21, 2022
@0618 0618 deleted the add-new-metric-logger branch September 21, 2022 20:24
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.

3 participants