Skip to content

Commit 5e1780d

Browse files
authored
Emit metrics from github workflows (#273)
1 parent 0b54593 commit 5e1780d

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/main-build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,30 @@ jobs:
143143
LISTEN_ADDRESS: 0.0.0.0:4567
144144
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-spark-awssdkv1:${{ github.sha }}
145145
VALIDATOR_COMMAND: -c spark-otel-trace-metric-validation.yml --endpoint http://app:4567 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }}
146+
147+
publish-build-status:
148+
runs-on: ubuntu-latest
149+
needs: [test_Spring_App_With_Java_Agent, test_Spark_App_With_Java_Agent, test_Spark_AWS_SDK_V1_App_With_Java_Agent]
150+
if: always()
151+
steps:
152+
- name: Configure AWS Credentials
153+
uses: aws-actions/configure-aws-credentials@v1
154+
with:
155+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
156+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
157+
158+
- name: Publish CI status
159+
run: |
160+
if [ '${{ needs.test_Spring_App_With_Java_Agent.result }}' = 'success' ] && \
161+
[ '${{ needs.test_Spark_App_With_Java_Agent.result }}' = 'success' ] && \
162+
[ '${{ needs.test_Spark_AWS_SDK_V1_App_With_Java_Agent.result }}' = 'success' ]; then
163+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
164+
--metric-name Success \
165+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=main-build \
166+
--value 1.0
167+
else
168+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
169+
--metric-name Success \
170+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=main-build \
171+
--value 0.0
172+
fi

.github/workflows/nightly-upstream-snapshot-build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,27 @@ jobs:
4646
with:
4747
name: aws-opentelemetry-agent.jar
4848
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
49+
publish-build-status:
50+
runs-on: ubuntu-latest
51+
needs: [build]
52+
if: always()
53+
steps:
54+
- name: Configure AWS Credentials
55+
uses: aws-actions/configure-aws-credentials@v1
56+
with:
57+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
58+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
59+
60+
- name: Publish CI status
61+
run: |
62+
if [ '${{ needs.build.result }}' = 'success' ]; then
63+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
64+
--metric-name Success \
65+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly-upstream-snapshot-build \
66+
--value 1.0
67+
else
68+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
69+
--metric-name Success \
70+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly-upstream-snapshot-build \
71+
--value 0.0
72+
fi

0 commit comments

Comments
 (0)