-
Notifications
You must be signed in to change notification settings - Fork 249
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
chore(repo): Updated CW Metrics #3741
Conversation
a2ddf75
to
c587a2c
Compare
c587a2c
to
85aeaf8
Compare
@@ -0,0 +1,103 @@ | |||
name: Log CW Metric Wrapper |
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.
Wrapper for log_cw_metric
Auto fills:
repo: ${{ github.repository }}
run-id: ${{ github.run_id }}
And calls configure AWS credentials
So that workflows that need to log metrics don't need to worry about these extra details.
job-status: | ||
description: Used to determine if we track success or failure. | ||
required: true | ||
job-identifier: |
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.
github does not return the current job id. While you can get current run id, when requesting run information you get all the jobs for that run. Thus to differentiate an individual job of that run, I needed to have this parameter for finding the particular job.
actions/bin/log_cw_metric.dart
Outdated
final jobStatus = core.getRequiredInput('job-status'); | ||
final jobIdentifier = core.getRequiredInput('job-identifier'); | ||
final githubToken = core.getRequiredInput('github-token'); | ||
final repo = core.getRequiredInput('repo'); | ||
final runId = core.getRequiredInput('run-id'); |
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.
Most of this info can be pulled from the action's context instead of needing to be passed in manually.
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 using the github context helped.
Still needed to keep some:
- Job status is only in the job.context.jobStatus
- Switched jobIdentifier (hardcoded in our workflow calls) with dart parsing logic on a matrix input
This extra complexity is largely due to Github not providing the current job id, which means we can only get the entire job list of a workflow run. We need some form of identifier to know which of those jobs is the actual job id we are currently running in.
actions/bin/log_cw_metric.dart
Outdated
|
||
final value = isFailed ? '1' : '0'; | ||
|
||
if (category.contains('/')) { |
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're already going through the hassle of passing in this value, why not pass in the category itself and compute it ahead of time as part of the generate workflows
command?
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.
That makes sense, though I'd rather keep our github action workflows clean and avoid adding additional params that are only needed for my logging flows.
Alternatively we can directly accept a packageName to the log metric method instead.
I've opened #3767 to make working with the GitHub context easier. |
e8264f7
to
08dac9f
Compare
62e7111
to
6a3bb4c
Compare
6197c29
to
617bf67
Compare
2e75b63
to
3cec5b1
Compare
3cec5b1
to
8e93481
Compare
Issue #, if available:
Description of changes:
Build upon existing CW Metric reporting to track additional dimensions in each metric.
Refactor CW Metric reporting to use Github Actions Dart -> JS framework.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.