Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/.github/workflows/logql-bench.yml

131 lines
4.1 KiB

name: LogQL benchmarks
on:
workflow_dispatch:
inputs:
ref:
description: "Git ref to run benchmarks on"
required: false
default: "main"
type: "string"
bench_chunks_v1:
description: "Benchmark V1 chunk store"
required: false
default: true
type: "boolean"
bench_dataobj_old_engine:
description: "Benchmark data object store with old engine"
required: false
default: true
type: "boolean"
bench_dataobj_new_engine:
description: "Benchmark data object store with new engine"
required: false
default: false # Disabled by default due to less complete implementation
type: "boolean"
instant_queries:
description: "Run benchmarks for Instant queries"
required: false
default: false
type: "boolean"
permissions: {}
jobs:
generate-testdata:
name: Generate test data
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.24.9"
# The metastore generates invalid filenames for Windows (with colons),
# which get rejected by upload-artifact. We zip these files to avoid this
# issue.
- name: Generate test data
run: make generate && zip -r data.zip data/
working-directory: ./pkg/logql/bench
- name: Upload test data
uses: actions/upload-artifact@v4
with:
name: logql-bench-testdata-${{ steps.checkout.outputs.commit }}
path: ./pkg/logql/bench/data.zip
retention-days: 7
setup-matrix:
name: Setup matrix
needs: generate-testdata
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
steps:
- name: Generate matrix
id: generate
run: |
STORES=()
# Use explicit equality checks to avoid template injection.
${{ inputs.bench_chunks_v1 == true }} && STORES+=("chunk")
${{ inputs.bench_dataobj_old_engine == true }} && STORES+=("dataobj")
${{ inputs.bench_dataobj_new_engine == true }} && STORES+=("dataobj-engine")
MATRIX_JSON=$(jq -nc --arg stores "${STORES[*]}" '{"store": $stores | split(" ")}')
echo "matrix=$MATRIX_JSON" >> "$GITHUB_OUTPUT"
benchmarks:
name: Run benchmarks for ${{ matrix.store }}
runs-on: github-hosted-ubuntu-arm64-large
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
fail-fast: false # Continue benchmarking other stores if one fails
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Download test data
uses: actions/download-artifact@v4.1.3
with:
name: logql-bench-testdata-${{ steps.checkout.outputs.commit }}
path: ./pkg/logql/bench
- name: Unzip test data
run: unzip data.zip
working-directory: ./pkg/logql/bench
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.24.9"
- name: Create results directory
run: mkdir -p ./pkg/logql/bench/results
- name: Run benchmarks
shell: bash # Use bash shell to propagate pipe failures
run: |
go test \
-run=^$ -bench=LogQL/query=.+/kind=.+/store=${{ matrix.store }}$ \
${{ inputs.instant_queries == true && '-range-type=instant' || '' }} \
-count=10 -timeout=5h -benchmem \
-cpuprofile=results/cpu.pprof \
-memprofile=results/mem.pprof \
| tee results/results.txt
working-directory: ./pkg/logql/bench
- name: Upload results
uses: actions/upload-artifact@v4
if: always() # Upload results even if one of the benchmark tests fails
with:
name: logql-bench-results-${{ matrix.store }}-${{ steps.checkout.outputs.commit }}
path: ./pkg/logql/bench/results
retention-days: 7