Skip to content

Commit 9e094eb

Browse files
authored
Send main build metrics (#447)
*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.
2 parents 4ea7469 + 35467b9 commit 9e094eb

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
@@ -109,3 +109,23 @@ jobs:
109109
with:
110110
staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }}
111111
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }}
112+
113+
publish-main-build-status:
114+
name: "Publish Main Build Status"
115+
needs: [ build, application-signals-e2e-test ]
116+
runs-on: ubuntu-latest
117+
if: always()
118+
steps:
119+
- name: Configure AWS Credentials for emitting metrics
120+
uses: aws-actions/configure-aws-credentials@v4
121+
with:
122+
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
123+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
124+
125+
- name: Publish main build status
126+
run: |
127+
value="${{ needs.build.result == 'success' && needs.application-signals-e2e-test.result == 'success' && '0.0' || '1.0'}}"
128+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
129+
--metric-name Failure \
130+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=main_build \
131+
--value $value

0 commit comments

Comments
 (0)