Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit dcd2360

Browse files
committed
fix: ci to run in parallel
Signed-off-by: Sahil Yeole <[email protected]>
1 parent 95b2c65 commit dcd2360

File tree

5 files changed

+33
-50
lines changed

5 files changed

+33
-50
lines changed

.github/workflows/bench.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ jobs:
1515
if: github.event.head_commit.message != 'Update performance results in README.md'
1616
env:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
19-
INFLUXDB_TOKEN: ${{ secrets.INFLUXDB_TOKEN }}
20-
INFLUXDB_ORG: ${{ secrets.INFLUXDB_ORG }}
21-
INFLUXDB_URL: ${{ secrets.INFLUXDB_URL }}
2218
strategy:
2319
matrix:
2420
service:
@@ -48,19 +44,6 @@ jobs:
4844
- name: Setup k6
4945
uses: grafana/setup-k6-action@v1
5046

51-
- name: Setup influxdb-cli
52-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
53-
run: |
54-
echo "UPLOAD_TO_CLOUD=true" >> $GITHUB_ENV
55-
mkdir -p influxdb
56-
cd influxdb
57-
wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
58-
tar xvzf influxdb2-client-2.7.5-linux-amd64.tar.gz
59-
cp influx /usr/local/bin/
60-
influx config create --config-name benchmark --host-url $INFLUXDB_URL --org $INFLUXDB_ORG --token $INFLUXDB_TOKEN --active
61-
cd ..
62-
rm -rf influxdb
63-
6447
- name: Run benchmarks
6548
run: |
6649
bash ./graphql/${{ matrix.service }}/setup.sh
@@ -78,10 +61,28 @@ jobs:
7861
analyze:
7962
needs: build
8063
runs-on: benchmarking-runner
64+
env:
65+
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
66+
INFLUXDB_TOKEN: ${{ secrets.INFLUXDB_TOKEN }}
67+
INFLUXDB_ORG: ${{ secrets.INFLUXDB_ORG }}
68+
INFLUXDB_URL: ${{ secrets.INFLUXDB_URL }}
8169
steps:
8270
- name: Checkout (GitHub)
8371
uses: actions/checkout@v4
8472

73+
- name: Setup influxdb-cli
74+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
75+
run: |
76+
echo "UPLOAD_TO_CLOUD=true" >> $GITHUB_ENV
77+
mkdir -p influxdb
78+
cd influxdb
79+
wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
80+
tar xvzf influxdb2-client-2.7.5-linux-amd64.tar.gz
81+
cp influx /usr/local/bin/
82+
influx config create --config-name benchmark --host-url $INFLUXDB_URL --org $INFLUXDB_ORG --token $INFLUXDB_TOKEN --active
83+
cd ..
84+
rm -rf influxdb
85+
8586
- name: Download all benchmark results
8687
uses: actions/download-artifact@v3
8788
with:

analyze.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ for idx in "${!servers[@]}"; do
4444
avgLatencies[${servers[$idx]}]=$(average "${latencyVals[@]}")
4545
done
4646

47-
echo "Server Value" >"$reqSecData"
48-
for server in "${servers[@]}"; do
49-
echo "$server ${avgReqSecs[$server]}" >>"$reqSecData"
50-
done
51-
52-
echo "Server Value" >"$latencyData"
53-
for server in "${servers[@]}"; do
54-
echo "$server ${avgLatencies[$server]}" >>"$latencyData"
55-
done
56-
5747
whichBench=1
5848
if [[ $1 == bench2* ]]; then
5949
whichBench=2

fetch_panels.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Get rendered panels from grafana
2+
from=$(date -u -d "-30 minutes" +"%Y-%m-%dT%H:%M:%S.%3NZ")
3+
now=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
4+
curl -o assets/posts_users_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-1&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
5+
curl -o assets/posts_users_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-2&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
6+
curl -o assets/posts_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-5&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
7+
curl -o assets/posts_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-6&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
8+
curl -o assets/greet_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-8&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
9+
curl -o assets/greet_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-9&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120

run_analyze_script.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ for bench in 1 2 3; do
3333
# Execute the command
3434
echo "Executing: $cmd"
3535
eval $cmd
36-
done
36+
done
37+
38+
if [[ "$UPLOAD_TO_CLOUD" == "true" ]]; then
39+
bash fetch_panels.sh
40+
fi

run_benchmarks.sh

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,33 +89,12 @@ if [[ ! " ${valid_services[@]} " =~ " ${service} " ]]; then
8989
exit 1
9090
fi
9191

92-
93-
94-
runBenchmark "graphql/${service}/run.sh"
92+
runBenchmark "${service}"
9593

9694
if [ "$service" == "apollo_server" ]; then
9795
cd graphql/apollo_server/
9896
npm stop
9997
cd ../../
10098
elif [ "$service" == "hasura" ]; then
10199
bash "graphql/hasura/kill.sh"
102-
fi
103-
104-
bash analyze.sh "${bench1Results[@]}"
105-
bash analyze.sh "${bench2Results[@]}"
106-
bash analyze.sh "${bench3Results[@]}"
107-
108-
if [[ "$UPLOAD_TO_CLOUD" == "true" ]]; then
109-
# Wait for 5 seconds to ensure the results are uploaded to influxdb
110-
sleep 5
111-
112-
# Get rendered panels from grafana
113-
from=$(date -u -d "-30 minutes" +"%Y-%m-%dT%H:%M:%S.%3NZ")
114-
now=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
115-
curl -o assets/posts_users_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-1&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
116-
curl -o assets/posts_users_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-2&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
117-
curl -o assets/posts_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-5&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
118-
curl -o assets/posts_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-6&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
119-
curl -o assets/greet_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-8&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
120-
curl -o assets/greet_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-9&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
121100
fi

0 commit comments

Comments
 (0)