From 8ae88af1fab8ae02d18826b1f6e9c3a7dde209ee Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sun, 2 Jun 2024 14:14:03 +0530 Subject: [PATCH] chore: push WRK output into the bencher [REVERT] (#2089) --- .github/workflows/benchmark.yml | 23 ------------------ ci-benchmark/wrk-output-to-json.js | 39 ------------------------------ 2 files changed, 62 deletions(-) delete mode 100644 ci-benchmark/wrk-output-to-json.js diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 4d6eebed1d..d437f9899c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -52,34 +52,11 @@ jobs: run: | wrk -d 30 -t 4 -c 100 -s wrk.lua http://localhost:8000/graphql > wrk-output.txt - - id: convert_wrk_output_json - name: Convert Output to JSON - working-directory: ci-benchmark - run: | - node wrk-output-to-json.js wrk-output.txt > results.json - - - id: push_to_bencher - working-directory: ci-benchmark - uses: bencherdev/bencher@main - run: | - bencher run \ - --project tailcall \ - --token '${{ secrets.BENCHER_API_TOKEN }}' \ - --branch '${{ github.head_ref }}' \ - --branch-start-point '${{ github.base_ref }}' \ - --branch-start-point-hash '${{ github.base_sha }}' \ - --testbed ubuntu-latest \ - --adapter json \ - --err \ - --file "results.json" - --github-actions '${{ secrets.GITHUB_TOKEN }}' \ - - id: convert_wrk_output_markdown name: Convert Output to Markdown working-directory: ci-benchmark run: | node wrk-output-to-md.js wrk-output.txt > body.md - - id: cat_md name: Cat Markdown working-directory: ci-benchmark diff --git a/ci-benchmark/wrk-output-to-json.js b/ci-benchmark/wrk-output-to-json.js deleted file mode 100644 index 7dd0b358fe..0000000000 --- a/ci-benchmark/wrk-output-to-json.js +++ /dev/null @@ -1,39 +0,0 @@ -const fs = require("fs") - -const wrkOutput = fs.readFileSync(process.argv[2], "utf8") - -const latencyAvgMatch = wrkOutput.match(/Latency\s+(\d+\.\d+)ms\s+(\d+\.\d+)ms\s+(\d+\.\d+)ms/) -const reqSecMatch = wrkOutput.match(/Req\/Sec\s+(\d+\.\d+k?)\s+(\d+\.\d+)\s+(\d+\.\d+k?)/) - -if (!latencyAvgMatch || !reqSecMatch) { - console.error("Error parsing " + process.argv[2]) - process.exit(1) -} - -const convertToNumber = (value) => { - if (value.endsWith("k")) { - return parseFloat(value.replace("k", "")) * 1000 - } - return parseFloat(value) -} - -const latency = { - value: parseFloat(latencyAvgMatch[1]), - lower_value: parseFloat(latencyAvgMatch[2]), - upper_value: parseFloat(latencyAvgMatch[3]), -} - -const reqSec = { - value: convertToNumber(reqSecMatch[1]), - lower_value: parseFloat(reqSecMatch[2]), - upper_value: convertToNumber(reqSecMatch[3]), -} - -const resultJson = { - benchmark_name: { - latency: latency, - req_sec: reqSec, - }, -} - -console.log(JSON.stringify(resultJson, null, 2))