Skip to content

Commit e7a2760

Browse files
authored
DEVPROD-17369 - Update generated config to use new data send script to replace perf.send (#1398)
* update generated config to use new data send script * Update .evergreen/scripts/send-perf-data.sh
1 parent b240a6c commit e7a2760

File tree

3 files changed

+51
-11
lines changed

3 files changed

+51
-11
lines changed

.evergreen/config_generator/components/benchmarks.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ class RunBenchmarks(Function):
2626
working_dir='mongo-cxx-driver',
2727
script='build/benchmark/microbenchmarks all',
2828
),
29-
30-
BuiltInCommand(
31-
command='perf.send',
32-
type=EvgCommandType.SYSTEM,
33-
params={
34-
'name': 'perf',
35-
'file': 'mongo-cxx-driver/results.json',
36-
}
29+
bash_exec(
30+
command_type=EvgCommandType.SYSTEM,
31+
working_dir='mongo-cxx-driver',
32+
script='.evergreen/scripts/send-perf-data.sh',
33+
include_expansions_in_env=['project_id', 'version_id', 'build_variant', 'parsed_order_id', 'task_name', 'task_id', 'execution', 'requester', 'revision_order_id'],
3734
),
3835
]
3936

.evergreen/generated_configs/functions.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,24 @@ functions:
142142
args:
143143
- -c
144144
- build/benchmark/microbenchmarks all
145-
- command: perf.send
145+
- command: subprocess.exec
146146
type: system
147147
params:
148-
name: perf
149-
file: mongo-cxx-driver/results.json
148+
binary: bash
149+
working_dir: mongo-cxx-driver
150+
include_expansions_in_env:
151+
- project_id
152+
- version_id
153+
- build_variant
154+
- parsed_order_id
155+
- task_name
156+
- task_id
157+
- execution
158+
- requester
159+
- revision_order_id
160+
args:
161+
- -c
162+
- .evergreen/scripts/send-perf-data.sh
150163
build-package-debian:
151164
- command: subprocess.exec
152165
type: test

.evergreen/scripts/send-perf-data.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
6+
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
7+
if [ "${requester}" == "commit" ]; then
8+
is_mainline=true
9+
else
10+
is_mainline=false
11+
fi
12+
13+
# Parse the username out of the order_id. Patches append the username. The raw perf results end point does not need the other information.
14+
parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}')
15+
16+
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
17+
"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}" \
18+
-H 'accept: application/json' \
19+
-H 'Content-Type: application/json' \
20+
-d @results.json)
21+
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
22+
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
23+
# We want to throw an error if the data was not successfully submitted
24+
if [ "$http_status" -ne 200 ]; then
25+
echo "Error: Received HTTP status $http_status"
26+
echo "Response Body: $response_body"
27+
exit 1
28+
fi
29+
echo "Response Body: $response_body"
30+
echo "HTTP Status: $http_status"

0 commit comments

Comments
 (0)