-
Notifications
You must be signed in to change notification settings - Fork 0
systems k6 runtime
Active contributors: Douwe de Vries
The k6 runtime generates executable k6 inputs, resolves the k6 binary, launches a child process, streams output and metrics, parses final summaries, and cleans up run artifacts. Most of this behavior lives in src-tauri/src/k6/process/runtime.rs.
src-tauri/src/importing/script.rs
src-tauri/src/importing/runtime.rs
src-tauri/src/k6/process/runtime.rs
src-tauri/src/k6/process/live_metrics.rs
src-tauri/src/k6/process/state.rs
src-tauri/src/k6/summary.rs
src-tauri/src/k6/report.rs
scripts/install-k6.sh
| Abstraction | File | Description |
|---|---|---|
| Generated script | src-tauri/src/importing/script.rs |
Embeds collection requests and k6 option logic |
K6BinaryResolution |
src-tauri/src/k6/process/runtime.rs |
k6 executable path and source |
RunTempArtifacts |
src-tauri/src/k6/process/runtime.rs |
Private temp directory with script.js, summary.json, and metrics.json
|
LiveMetricsAggregator |
src-tauri/src/k6/process/live_metrics.rs |
Converts JSON metric lines into live snapshots |
CompletionRecord |
src-tauri/src/k6/process/state.rs |
Data stored when a run reaches a terminal state |
graph TD
Options[K6Options] --> Env[Environment variables]
Script[Generated script] --> Temp[Private run artifacts]
Env --> Command[k6 run]
Temp --> Command
Command --> Output[stdout/stderr forwarders]
Command --> Metrics[metrics.json forwarder]
Command --> Summary[summary.json parser]
Output --> Events[k6:output]
Metrics --> Events2[k6:metrics]
Summary --> Events3[k6:complete]
start_k6_process in src-tauri/src/k6/process/runtime.rs serializes variable overrides, selected request IDs, and request weights into JSON environment variables. It also passes VUs, duration, ramp-up settings, thresholds, auth token, base URL, traffic mode, and advanced options.
k6 resolution checks LOADRIFT_K6_BIN, Tauri resources, executable directories, manifest bin, working directory, and PATH. scripts/install-k6.sh installs the bundled binary used by development and packaged builds.
Run artifacts are created with private permissions. The marker file identifies Load Rift-owned k6 artifact directories. Artifacts are normally deleted after completion, but LOADRIFT_PRESERVE_K6_ARTIFACTS=true keeps them for debugging. Startup cleanup only removes stale marker-owned directories after safety checks.
The runtime receives requests from Tauri backend, emits events through Command API bridge, and feeds Results and reporting.
Change generated k6 behavior in src-tauri/src/importing/script.rs. Change binary lookup, env vars, child process handling, or artifact cleanup in src-tauri/src/k6/process/runtime.rs. Change live metrics in src-tauri/src/k6/process/live_metrics.rs.
| File | Purpose |
|---|---|
src-tauri/src/importing/script.rs |
k6 JavaScript generation |
src-tauri/src/k6/process/runtime.rs |
k6 launch, stop, completion, and artifact lifecycle |
src-tauri/src/k6/process/live_metrics.rs |
Live metrics aggregation |
src-tauri/src/k6/process/state.rs |
Runtime state transitions |
src-tauri/src/k6/summary.rs |
Final summary parsing and fallback results |