Skip to content

Commit 2a46acd

Browse files
authored
Send main build metrics (#240)
*Issue #, if available:* *Description of changes:* Emit a failure metric if main build fails. Since this workflow is triggered with pushes to main or a release branch, we want to be notified if there is a failure with the build process or e2e tests. Tested by temporarily adding an `on: push:` trigger to my own branch in this repo and testing the updated workflow. Verified that failure metric was successfully published to cloudwatch. https://github.com/aws-observability/aws-otel-js-instrumentation/actions/runs/16764243839 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 7a70e6e commit 2a46acd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/main-build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,23 @@ jobs:
104104
with:
105105
staging-instrumentation-name: ${{ needs.build.outputs.staging_tarball_file }}
106106
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-node-staging:${{ needs.build.outputs.node_image_tag }}
107+
108+
publish-main-build-status:
109+
name: "Publish Main Build Status"
110+
needs: [ build, application-signals-e2e-test ]
111+
runs-on: ubuntu-latest
112+
if: always()
113+
steps:
114+
- name: Configure AWS Credentials for emitting metrics
115+
uses: aws-actions/configure-aws-credentials@v4
116+
with:
117+
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
118+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
119+
120+
- name: Publish main build status
121+
run: |
122+
value="${{ needs.build.result == 'success' && needs.application-signals-e2e-test.result == 'success' && '0.0' || '1.0'}}"
123+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
124+
--metric-name Failure \
125+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=main_build \
126+
--value $value

0 commit comments

Comments
 (0)