@@ -240,9 +240,38 @@ functions:
240240 args : [*task-runner, pr-task]
241241
242242 send-perf-data :
243- - command : perf.send
243+ # Here we begin to generate the request to send the data to SPS
244+ - command : shell.exec
244245 params :
245- file : src/go.mongodb.org/mongo-driver/perf.json
246+ script : |
247+ # We use the requester expansion to determine whether the data is from a mainline evergreen run or not
248+ if [ "${requester}" == "commit" ]; then
249+ is_mainline=true
250+ else
251+ is_mainline=false
252+ fi
253+
254+ # We parse the username out of the order_id as patches append that in and SPS does not need that information
255+ parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}')
256+ # Submit the performance data to the SPS endpoint
257+ response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
258+ "https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=$parsed_order_id&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=$is_mainline" \
259+ -H 'accept: application/json' \
260+ -H 'Content-Type: application/json' \
261+ -d @src/go.mongodb.org/mongo-driver/perf.json)
262+
263+ http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
264+ response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
265+
266+ # We want to throw an error if the data was not successfully submitted
267+ if [ "$http_status" -ne 200 ]; then
268+ echo "Error: Received HTTP status $http_status"
269+ echo "Response Body: $response_body"
270+ exit 1
271+ fi
272+
273+ echo "Response Body: $response_body"
274+ echo "HTTP Status: $http_status"
246275
247276 run-enterprise-auth-tests :
248277 - command : ec2.assume_role
0 commit comments