Skip to content

Commit

Permalink
USAGOV-2100: Send call center wait times to the logs (#2093)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsabelLaurenceau authored Nov 26, 2024
2 parents 9e59833 + 2e750c8 commit bb8b177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@ workflows:
- dev
- stage
- prod

- build-and-push-container-cron:
requires:
- approve-build-and-push-container-cron
Expand Down
11 changes: 10 additions & 1 deletion .docker/src-cron/opt/callcenter/call-center-update
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ tokenResponse=$(
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=$CALL_CENTER_CLIENT_ID&client_secret=$CALL_CENTER_CLIENT_SECRET"
)

token=$(echo "$tokenResponse" | jq -r '.access_token')
if [ $token = "null" ]; then
# log the problem and exit
echo '{"CallCenterWaitTimes": ' "$tokenResponse" ' "level":"error" }'
echo # newline in logs
exit 1
fi

# echo "Getting en wait time."
enWaitTimeResponse=$(
Expand Down Expand Up @@ -65,9 +72,11 @@ combinedWaitTimes='{
}'

# echo "Setting wait time file."
# echo "$combinedWaitTimes" >&2
echo "$combinedWaitTimes" > $waitTimeFile

# Emit data to STDOUT For logging purposes:
echo '{ "CallCenterWaitTimes": ' "$combinedWaitTimes", ' "message":"Retrieved call center wait times" }' | jq -c

# Upload file to S3 bucket
# echo "uploading waittime.json to S3."
aws_cp waittime.json s3://$S3_BUCKET/$VERSION/waittime.json

0 comments on commit bb8b177

Please sign in to comment.