Central, reusable observability stack for k6 performance tests.
Teams only run k6 in their own repos. They do not deploy Grafana/InfluxDB or maintain dashboards.
All results flow into a shared InfluxDB bucket and are visualized in Grafana with a standard dashboard.
- Grafana (persistent, always‑on)
- InfluxDB v2 (persistent, always‑on; stores k6 metrics)
- k6 Runner Image
Custom k6 built withxk6-output-influxdbso CI jobs can stream results to InfluxDB. - Grafana template dashboard
Variables:script(k6 script name)api(per‑request tag)
k6 jobs are ephemeral; Grafana/InfluxDB remain up for browsing history.
.
├─ infra/
│ ├─ docker-compose.local.yml # local InfluxDB + Grafana
│ └─ helm/ # k8s deployment
├─ grafana/
│ ├─ provisioning/ # datasource + dashboard provider
│ └─ dashboards/
│ └─ k6-template-influxdb2.json
├─ k6-runner/
│ ├─ Dockerfile # builds k6 with influxdb v2 output
│ └─ entrypoint.sh # runs k6 with script-level tags
├─ ci/
│ ├─ gitlab/k6-run.yml # reusable GitLab template
│ └─ github/k6-run.yml # reusable GitHub workflow
├─ launcher/ # Web UI for launching k6 tests
│ └─ frontend/ # Next.js application
└─ samples/
├─ api-smoke.js # 3 API sample
└─ api-load.js # 2 API sample
From repo root:
docker compose -f infra/docker-compose.local.yml up -dServices:
- InfluxDB: http://localhost:8086
- Grafana: http://localhost:3000 (admin / admin)
- Open InfluxDB UI → http://localhost:8086
- Login:
- user:
admin - pass:
adminadmin
- user:
- Load Data → API Tokens → Generate
- Create token with Write access to bucket
k6 - Copy token.
Edit infra/docker-compose.local.yml:
grafana:
environment:
INFLUXDB_TOKEN: "PASTE_REAL_TOKEN_HERE"Restart Grafana:
docker compose -f infra/docker-compose.local.yml restart grafanadocker build -t perf/k6-runner:local ./k6-runnerSmoke test (3 APIs):
docker run --rm -e K6_SCRIPT=/work/samples/api-smoke.js -e K6_SCRIPT_NAME=api-smoke -e K6_TEAM=local -e K6_INFLUXDB_ADDR=http://host.docker.internal:8086 -e K6_INFLUXDB_ORG=perf-org -e K6_INFLUXDB_BUCKET=k6 -e K6_INFLUXDB_TOKEN="PASTE_REAL_TOKEN_HERE" -v "$PWD:/work" perf/k6-runner:localLoad test (2 APIs):
docker run --rm -e K6_SCRIPT=/work/samples/api-load.js -e K6_SCRIPT_NAME=api-load -e K6_TEAM=local -e K6_INFLUXDB_ADDR=http://host.docker.internal:8086 -e K6_INFLUXDB_ORG=perf-org -e K6_INFLUXDB_BUCKET=k6 -e K6_INFLUXDB_TOKEN="PASTE_REAL_TOKEN_HERE" -v "$PWD:/work" perf/k6-runner:local- Open Grafana → http://localhost:3000
- Dashboards → Browse → k6 - Template (InfluxDB2)
- Select:
script:api-smokeorapi-loadapi: pick specific endpoint orAll
A clean web interface for launching k6 tests without writing code.
-
Set the InfluxDB token in docker-compose:
# Edit infra/docker-compose.local.yml and set K6_INFLUXDB_TOKEN -
Start all services (including launcher):
docker compose -f infra/docker-compose.local.yml up -d
-
Access the launcher UI:
- Open http://localhost:3001
- Enter your API endpoint and configure load profile
- Click "Run Load Test"
- View results via the Grafana link
For local development of the launcher:
cd launcher
npm install
# Create .env.local with your InfluxDB token
npm run devSee launcher/README.md for detailed documentation.
Each HTTP call should include an api tag so the API dropdown works.
Example:
http.get(`${BASE_URL}/users`, {
tags: { api: "list_users" }
});Runner adds test‑wide tags:
script=<K6_SCRIPT_NAME>team=<K6_TEAM>testid=<CI id or local>