From 45dd9c013181839f1ef2204eafcff8ec611a463e Mon Sep 17 00:00:00 2001 From: Ahmad Shah Date: Fri, 2 May 2025 18:14:10 -0400 Subject: [PATCH 1/2] update generated config to use new data send script --- .../config_generator/components/benchmarks.py | 13 ++++---- .evergreen/generated_configs/functions.yml | 19 ++++++++++-- .evergreen/scripts/send-perf-data.sh | 30 +++++++++++++++++++ 3 files changed, 51 insertions(+), 11 deletions(-) create mode 100755 .evergreen/scripts/send-perf-data.sh diff --git a/.evergreen/config_generator/components/benchmarks.py b/.evergreen/config_generator/components/benchmarks.py index b1d5019168..b5bb8b269e 100644 --- a/.evergreen/config_generator/components/benchmarks.py +++ b/.evergreen/config_generator/components/benchmarks.py @@ -26,14 +26,11 @@ class RunBenchmarks(Function): working_dir='mongo-cxx-driver', script='build/benchmark/microbenchmarks all', ), - - BuiltInCommand( - command='perf.send', - type=EvgCommandType.SYSTEM, - params={ - 'name': 'perf', - 'file': 'mongo-cxx-driver/results.json', - } + bash_exec( + command_type=EvgCommandType.SYSTEM, + working_dir='mongo-cxx-driver', + script='.evergreen/scripts/send-perf-data.sh', + include_expansions_in_env=['project_id', 'version_id', 'build_variant', 'parsed_order_id', 'task_name', 'task_id', 'execution', 'requester', 'revision_order_id'], ), ] diff --git a/.evergreen/generated_configs/functions.yml b/.evergreen/generated_configs/functions.yml index 41339470ca..def9610319 100644 --- a/.evergreen/generated_configs/functions.yml +++ b/.evergreen/generated_configs/functions.yml @@ -142,11 +142,24 @@ functions: args: - -c - build/benchmark/microbenchmarks all - - command: perf.send + - command: subprocess.exec type: system params: - name: perf - file: mongo-cxx-driver/results.json + binary: bash + working_dir: mongo-cxx-driver + include_expansions_in_env: + - project_id + - version_id + - build_variant + - parsed_order_id + - task_name + - task_id + - execution + - requester + - revision_order_id + args: + - -c + - .evergreen/scripts/send-perf-data.sh build-package-debian: - command: subprocess.exec type: test diff --git a/.evergreen/scripts/send-perf-data.sh b/.evergreen/scripts/send-perf-data.sh new file mode 100755 index 0000000000..e6380c1761 --- /dev/null +++ b/.evergreen/scripts/send-perf-data.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail + +# 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 + +# We parse the username out of the order_id as patches append that in and the raw perf results end point does not need that information +parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') + +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 @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" From fe6d784fb54fb350af52207761b8c297afe1051c Mon Sep 17 00:00:00 2001 From: Ahmad Shah <112424973+MAhmadShah@users.noreply.github.com> Date: Mon, 5 May 2025 14:11:05 -0400 Subject: [PATCH 2/2] Update .evergreen/scripts/send-perf-data.sh Co-authored-by: Kevin Albertson --- .evergreen/scripts/send-perf-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/scripts/send-perf-data.sh b/.evergreen/scripts/send-perf-data.sh index e6380c1761..c9882279d3 100755 --- a/.evergreen/scripts/send-perf-data.sh +++ b/.evergreen/scripts/send-perf-data.sh @@ -10,7 +10,7 @@ else is_mainline=false fi -# We parse the username out of the order_id as patches append that in and the raw perf results end point does not need that information +# Parse the username out of the order_id. Patches append the username. The raw perf results end point does not need the other information. parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \