From 22ca17b8b4dea4729e3ace50498b7149c5508ab7 Mon Sep 17 00:00:00 2001 From: Ahmad Shah Date: Wed, 23 Jul 2025 10:14:48 -0400 Subject: [PATCH] replace perf.send --- .evergreen.yml | 33 +++++++++++++++++++++++++++++++-- .evergreen/evergreen.yml.in | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/.evergreen.yml b/.evergreen.yml index cd7f743023..60702068c0 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -4402,9 +4402,38 @@ functions: sh -c 'MONGOSH_SMOKE_TEST_SERVER="$MONGODB_URI" ./dist/mongosh --perfTests > perf_results.json' env: DISTRO_ID: ${distro_id} - - command: perf.send + - command: shell.exec params: - file: src/perf_results.json + script: | + # We use the requester expansion to determine whether the data is from a mainline evergreen run or not + if [ "${requester}" == "commit" ]; then + is_mainline=true + else + is_mainline=false + fi + + # Parse the username out of the order_id. Patches append the username. The Signal Processing Service (SPS) endpoint does not need the other information. + parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') + + # Submit the performance data to the SPS endpoint + response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \ + "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" \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d @src/perf_results.json) + + http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}') + response_body=$(echo "$response" | sed '/HTTP_STATUS/d') + + # We want to throw an error if the data was not successfully submitted + if [ "$http_status" -ne 200 ]; then + echo "Error: Received HTTP status $http_status" + echo "Response Body: $response_body" + exit 1 + fi + + echo "Response Body: $response_body" + echo "HTTP Status: $http_status" # Tasks will show up as the individual blocks in the Evergreen UI that can # pass or fail. diff --git a/.evergreen/evergreen.yml.in b/.evergreen/evergreen.yml.in index d39c1bbba2..8fca8ef6df 100644 --- a/.evergreen/evergreen.yml.in +++ b/.evergreen/evergreen.yml.in @@ -1047,10 +1047,39 @@ functions: sh -c 'MONGOSH_SMOKE_TEST_SERVER="$MONGODB_URI" ./dist/mongosh --perfTests > perf_results.json' env: DISTRO_ID: ${distro_id} - - command: perf.send + - command: shell.exec params: - file: src/perf_results.json + script: | + # We use the requester expansion to determine whether the data is from a mainline evergreen run or not + if [ "${requester}" == "commit" ]; then + is_mainline=true + else + is_mainline=false + fi + + # Parse the username out of the order_id. Patches append the username. The Signal Processing Service (SPS) endpoint does not need the other information. + parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') + + # Submit the performance data to the SPS endpoint + response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \ + "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" \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d @src/perf_results.json) + + http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}') + response_body=$(echo "$response" | sed '/HTTP_STATUS/d') + + # We want to throw an error if the data was not successfully submitted + if [ "$http_status" -ne 200 ]; then + echo "Error: Received HTTP status $http_status" + echo "Response Body: $response_body" + exit 1 + fi + echo "Response Body: $response_body" + echo "HTTP Status: $http_status" + # Tasks will show up as the individual blocks in the Evergreen UI that can # pass or fail. #