From f1ae5586b12f864995f04b5ff9453f71e694bd7f Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sat, 20 Jun 2026 20:34:46 +0200 Subject: [PATCH] Fix Tinybird benchmark runner auth --- tinybird/README.md | 1 + tinybird/run.sh | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tinybird/README.md b/tinybird/README.md index f527b516dd..ab123497e1 100644 --- a/tinybird/README.md +++ b/tinybird/README.md @@ -32,3 +32,4 @@ use the auto mode to make sure all the files are read. # Querying the data Once the data is inserted you can create the endpoints needed to run the benchmark using pipes. `run.sh` will iterate through each endpoint. +Set `TINYBIRD_TOKEN` to a Tinybird token with read access before running the script. diff --git a/tinybird/run.sh b/tinybird/run.sh index 81733a08bb..991de41358 100755 --- a/tinybird/run.sh +++ b/tinybird/run.sh @@ -1,19 +1,18 @@ #!/bin/bash +set -euo pipefail -# Define the base URL and Authorization token BASE_URL="https://api.tinybird.co/v0/pipes/" -AUTH_HEADER= +: "${TINYBIRD_TOKEN:?Set TINYBIRD_TOKEN}" +AUTH_HEADER="Authorization: Bearer ${TINYBIRD_TOKEN}" results="[" for i in {1..43}; do times=() for j in {1..3}; do - response=$(curl -s --compressed -H "$AUTH_HEADER" "${BASE_URL}Q${i}.json") - - elapsed=$(echo "$response" | jq '.statistics.elapsed') - echo "$elapsed" - times+=($elapsed) + response=$(curl -fsS --compressed -H "$AUTH_HEADER" "${BASE_URL}Q${i}.json") + elapsed=$(jq -er '.statistics.elapsed | numbers' <<< "$response") + times+=("$elapsed") done results+=$(printf "[%s,%s,%s]," "${times[0]}" "${times[1]}" "${times[2]}") done