generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 12
Adding metric of time since last CodeOSS version update in update automation workflow #56
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
Merged
+48
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c0124c
add NewReleaseDetected metric for monitoring upstream releases
4c7a841
Replace NewReleaseDetected metric with CodeOSSReleaseLag metric
3867c9f
add NewReleaseDetected metric for monitoring upstream releases
64b2638
Replace NewReleaseDetected metric with CodeOSSReleaseLag metric
7e10df8
Merge branch 'alarm-no-update' of https://github.com/feiyangliu2023/c…
07e3779
Changing normalized metric value from month to day
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,6 +404,52 @@ jobs: | |
echo "Created PR from ${{ needs.update-automation.outputs.staging-branch }} to $TARGET_BRANCH" | ||
publish-release-lag-metric: | ||
name: Publish Release Lag Metric | ||
runs-on: ubuntu-latest | ||
needs: [update-automation] | ||
if: always() | ||
environment: update-automation-workflow-env | ||
permissions: | ||
id-token: write # Required for OIDC | ||
contents: read | ||
env: | ||
REPOSITORY: ${{ github.repository }} | ||
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 1 | ||
|
||
- name: Use role credentials for metrics | ||
id: aws-creds | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }} | ||
aws-region: us-east-1 | ||
|
||
- name: Calculate and publish release lag metric | ||
if: steps.aws-creds.outcome == 'success' | ||
run: | | ||
cd third-party-src | ||
SUBMODULE_COMMIT_TIMESTAMP=$(git log -1 --format=%ct) | ||
cd .. | ||
CURRENT_TIMESTAMP=$(date +%s) | ||
SECONDS_BEHIND=$((CURRENT_TIMESTAMP - SUBMODULE_COMMIT_TIMESTAMP)) | ||
NORMALIZED_VALUE=$(awk "BEGIN {printf \"%.6f\", $SECONDS_BEHIND / 86400}") | ||
aws cloudwatch put-metric-data \ | ||
--namespace "GitHub/Workflows" \ | ||
--metric-name "CodeOSSReleaseLag" \ | ||
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \ | ||
--value $NORMALIZED_VALUE \ | ||
--unit None | ||
echo "Published metric: CodeOSSReleaseLag = $NORMALIZED_VALUE (equivalent to $NORMALIZED_VALUE days behind upstream)" | ||
send-notification: | ||
name: Send Notification | ||
runs-on: ubuntu-latest | ||
|
@@ -434,7 +480,7 @@ jobs: | |
publish-success-metrics: | ||
name: Publish Success Metrics | ||
runs-on: ubuntu-latest | ||
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification] | ||
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification, publish-release-lag-metric] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, to make sure it is run before deciding success and failure metric |
||
environment: update-automation-workflow-env | ||
if: always() && !failure() && !cancelled() | ||
permissions: | ||
|
@@ -463,7 +509,7 @@ jobs: | |
publish-failure-metrics: | ||
name: Publish Failure Metrics | ||
runs-on: ubuntu-latest | ||
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification] | ||
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification, publish-release-lag-metric] | ||
environment: update-automation-workflow-env | ||
if: failure() | ||
permissions: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what if this condition is not meet, how can we detect it? will it be covered by automation update missing alarm?
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.
Yes, in the case if metric is missing alarm will also be triggered
treatMissingData: TreatMissingData.BREACHING