Skip to content

Commit 5077ae5

Browse files
authored
DEVPROD-17371 Replace perf.send with direct data submission to new end point (#1370)
1 parent 7208462 commit 5077ae5

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

.evergreen/benchmarks.yml

+32-2
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,39 @@ functions:
202202
display_name: "mongodb-logs.tar.gz"
203203

204204
"upload benchmark results":
205-
- command: perf.send
205+
- command: shell.exec
206206
params:
207-
file: "src/benchmark-results.json"
207+
script: |
208+
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
209+
if [ "${requester}" == "commit" ]; then
210+
is_mainline=true
211+
else
212+
is_mainline=false
213+
fi
214+
215+
parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}')
216+
217+
ENCODED_URL=$(echo "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" | sed -e 's/ /%20/g')
218+
219+
# Submit the performance data to the SPS endpoint
220+
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
221+
"$ENCODED_URL" \
222+
-H 'accept: application/json' \
223+
-H 'Content-Type: application/json' \
224+
-d @src/benchmark-results.json)
225+
226+
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
227+
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
228+
229+
# We want to throw an error if the data was not successfully submitted
230+
if [ "$http_status" -ne 200 ]; then
231+
echo "Error: Received HTTP status $http_status"
232+
echo "Response Body: $response_body"
233+
exit 1
234+
fi
235+
236+
echo "Response Body: $response_body"
237+
echo "HTTP Status: $http_status"
208238
209239
"stop mongo orchestration":
210240
- command: shell.exec

0 commit comments

Comments
 (0)