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
9 changes: 9 additions & 0 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ functions:
args:
- .evergreen/run-tests.sh

"perf send":
- command: subprocess.exec
params:
working_dir: src
binary: bash
add_expansions_to_env: true
args:
- .evergreen/perf-send.sh

"run serverless tests":
- command: timeout.update
params:
Expand Down
28 changes: 13 additions & 15 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ functions:
binary: bash
args:
- .evergreen/run-tests.sh
perf send:
- command: subprocess.exec
params:
working_dir: src
binary: bash
add_expansions_to_env: true
args:
- .evergreen/perf-send.sh
run serverless tests:
- command: timeout.update
params:
Expand Down Expand Up @@ -1891,9 +1899,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/test/benchmarks/driver_bench/results.json
- func: perf send
- name: run-spec-benchmark-tests-node-server-timeoutMS-120000
tags:
- run-spec-benchmark-tests
Expand All @@ -1912,9 +1918,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/test/benchmarks/driver_bench/results.json
- func: perf send
- name: run-spec-benchmark-tests-node-server-timeoutMS-0
tags:
- run-spec-benchmark-tests
Expand All @@ -1933,9 +1937,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/test/benchmarks/driver_bench/results.json
- func: perf send
- name: run-spec-benchmark-tests-node-server-monitorCommands-true
tags:
- run-spec-benchmark-tests
Expand All @@ -1954,9 +1956,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/test/benchmarks/driver_bench/results.json
- func: perf send
- name: run-spec-benchmark-tests-node-server-logging
tags:
- run-spec-benchmark-tests
Expand All @@ -1975,9 +1975,7 @@ tasks:
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/test/benchmarks/driver_bench/results.json
- func: perf send
- name: run-unit-tests-node-16
tags:
- unit-tests
Expand Down
9 changes: 3 additions & 6 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,9 @@ function addPerformanceTasks() {
...[
'install dependencies',
'bootstrap mongo-orchestration',
'run spec driver benchmarks'
].map(func => ({ func })),
{
command: 'perf.send',
params: { file: 'src/test/benchmarks/driver_bench/results.json' }
}
'run spec driver benchmarks',
'perf send'
].map(func => ({ func }))
]
});

Expand Down
9 changes: 9 additions & 0 deletions .evergreen/perf-send.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euox pipefail

source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh

TARGET_FILE=$(realpath "${TARGET_FILE:-./test/benchmarks/driver_bench/results.json}")

node ./.evergreen/perf_send.mjs $TARGET_FILE
63 changes: 63 additions & 0 deletions .evergreen/perf_send.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import fs from 'fs/promises';
import util from 'util';

const API_PATH = 'https://performance-monitoring-api.corp.mongodb.com/raw_perf_results';

const resultFile = process.argv[2];
if (resultFile == null) {
throw new Error('Must specify result file');
}

// Get expansions
const {
execution,
requester,
project,
task_id,
task_name,
revision_order_id,
build_variant: variant,
version_id: version
} = process.env;

const orderSplit = revision_order_id?.split('_');
const order = Number(orderSplit ? orderSplit[orderSplit.length - 1] : undefined);

if (!Number.isInteger(order)) throw new Error(`Failed to parse integer from order, revision_order_id=${revision_order_id}`);

const results = JSON.parse(await fs.readFile(resultFile, 'utf8'));

const body = {
id: {
project,
version,
variant,
order,
task_name,
task_id,
execution,
mainline: requester === 'commit'
},
results
};

const resp = await fetch(API_PATH, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
},
body: JSON.stringify(body)
});

const responseText = await resp.text();
let jsonResponse = null;
try {
jsonResponse = JSON.parse(responseText)
} catch (cause) {
console.log('Failed to parse json response', cause);
}

console.log(resp.statusText, util.inspect(jsonResponse ?? responseText, { depth: Infinity }));

if (jsonResponse.message == null) throw new Error("Didn't get success message");
4 changes: 4 additions & 0 deletions test/benchmarks/driver_bench/src/driver.mts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ export type MetricInfo = {
test_name: string;
args: Record<string, number>;
};
created_at: string;
completed_at: string;
metrics: Metric[];
};

Expand All @@ -161,6 +163,8 @@ export function metrics(test_name: string, result: number, tags?: string[]): Met
])
)
},
created_at: new Date().toISOString(),
completed_at: new Date().toISOString(),
// FIXME(NODE-6781): For now all of our metrics are of throughput so their improvement_direction is up,
metrics: [
{
Expand Down