Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,20 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUNTIME_PARAM: ${{ matrix.runtime-param }}
run: ./scripts/run_integration_tests.sh

- name: Send success metric
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
run: ./scripts/send_status_metric.sh 0 $DD_API_KEY

integration-test-failure:
runs-on: ubuntu-latest
needs: [integration-test]
if: always() && (needs.integration-test.result == 'failure')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Send a failure metric
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
run: ./scripts/send_status_metric.sh 1 $DD_API_KEY
29 changes: 29 additions & 0 deletions scripts/send_status_metric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
if [ -z $GITHUB_REF ]; then
echo "GITHUB_REF is not set, not sending the metric"
exit 0
fi

if [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "Not on the main branch, not sending the metric"
exit 0
fi

#Retrieve the status
# 0 means success
# 1 means failure
STATUS=$1

API_KEY=$2
CURRENT_TIME=$(date +%s)

#Send the metric
curl -H "Content-type: application/json" \
-H "DD-API-KEY: ${API_KEY}" \
-d "{ \"series\" :
[{\"metric\":\"serverless.integration_test.python.status\",
\"points\":[[$CURRENT_TIME, $STATUS]],
\"type\":\"gauge\",
\"tags\":[\"service:serverless-integration-test\"]}
]
}" \
'https://app.datadoghq.com/api/v1/series'