File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 9999 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
100100 RUNTIME_PARAM : ${{ matrix.runtime-param }}
101101 run : ./scripts/run_integration_tests.sh
102+
103+ - name : Send success metric
104+ env :
105+ DD_API_KEY : ${{ secrets.DD_API_KEY }}
106+ run : ./scripts/send_status_metric.sh 0 $DD_API_KEY
107+
108+ integration-test-failure :
109+ runs-on : ubuntu-latest
110+ needs : [integration-test]
111+ if : always() && (needs.integration-test.result == 'failure')
112+ steps :
113+ - name : Checkout
114+ uses : actions/checkout@v2
115+ - name : Send a failure metric
116+ env :
117+ DD_API_KEY : ${{ secrets.DD_API_KEY }}
118+ run : ./scripts/send_status_metric.sh 1 $DD_API_KEY
Original file line number Diff line number Diff line change 1+ if [ -z $GITHUB_REF ]; then
2+ echo " GITHUB_REF is not set, not sending the metric"
3+ exit 0
4+ fi
5+
6+ if [ " $GITHUB_REF " != " refs/heads/main" ]; then
7+ echo " Not on the main branch, not sending the metric"
8+ exit 0
9+ fi
10+
11+ # Retrieve the status
12+ # 0 means success
13+ # 1 means failure
14+ STATUS=$1
15+
16+ API_KEY=$2
17+ CURRENT_TIME=$( date +%s)
18+
19+ # Send the metric
20+ curl -H " Content-type: application/json" \
21+ -H " DD-API-KEY: ${API_KEY} " \
22+ -d " { \" series\" :
23+ [{\" metric\" :\" serverless.integration_test.python.status\" ,
24+ \" points\" :[[$CURRENT_TIME , $STATUS ]],
25+ \" type\" :\" gauge\" ,
26+ \" tags\" :[\" service:serverless-integration-test\" ]}
27+ ]
28+ }" \
29+ ' https://app.datadoghq.com/api/v1/series'
You can’t perform that action at this time.
0 commit comments