Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .evergreen/config_generator/components/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ 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=[
'build_variant',
'execution',
'parsed_order_id',
'project_id',
'requester',
'revision_order_id',
'task_id',
'task_name',
'version_id',
],
),
]

Expand Down
18 changes: 15 additions & 3 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,23 @@ 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
- 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
Expand Down
30 changes: 30 additions & 0 deletions .evergreen/scripts/send-perf-data.sh
Original file line number Diff line number Diff line change
@@ -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

# 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' \
"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')
Comment on lines +21 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
http_status="$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')"
response_body="$(echo "$response" | sed '/HTTP_STATUS/d')"

SC2086. Also applies to other instances of var=$(...) above.

# We want to throw an error if the data was not successfully submitted
[[ "${http_status:?}" -eq 200 ]] || {
echo "Error: Received HTTP status $http_status"
echo "Response Body: $response_body"
exit 1
} >&2
echo "Response Body: $response_body"
echo "HTTP Status: $http_status"