Skip to content

fix(cli): harden run parsing and improve throughput metrics#69

Merged
Cianidos merged 8 commits into
mainfrom
fix/cli-arguments-parsing
Apr 30, 2026
Merged

fix(cli): harden run parsing and improve throughput metrics#69
Cianidos merged 8 commits into
mainfrom
fix/cli-arguments-parsing

Conversation

@Cianidos
Copy link
Copy Markdown
Contributor

@Cianidos Cianidos commented Apr 30, 2026

Description of Changes

This PR hardens stroppy run argument parsing and improves workload/runtime metrics reporting.

Main changes:

  • Validates run positionals more strictly: script and optional SQL override must be adjacent before --.
  • Reports invalid run configuration errors with k6 InvalidConfig exit codes.
  • Adds validation and deep merge handling for driver setup overrides in Go and TypeScript.
  • Logs applied script env values with secret-like values redacted and warns about undeclared workload env keys.
  • Captures k6 exit codes through an explicit capture guard.
  • Adds Go-side transaction metrics: tx_count and active 1s tx_tps buckets.
  • Extends TPC-C summaries with average query throughput, whole-run tx throughput, and split TPS percentile output including p1, p5, and p10.

Example of the changed report section:

===== Driver query / tx metrics =====
  queries executed    : 708213
  avg query throughput: 47264.24/s
  tx attempts         : 74587
  avg tx throughput   : 4977.74/s  (whole run)
  tx_tps buckets (tx/s): avg=7458.3  p1=7053.8  p5=7084.7  p10=7123.4
                         p50=7399.5  p90=7754.9  p95=7803.9  p99=7843.2  (active 1s buckets)

Motivation and Context

The run command accepted several ambiguous argument shapes, especially around mixed positionals, driver/env key-value arguments, and k6 passthrough flags. This made invalid invocations hard to diagnose and could route user intent incorrectly.

The driver/env validation and logging changes make CLI/config behavior more explicit and easier to debug. The TPS metrics add a transaction-oriented throughput view that is separate from k6 iteration rate and query rate, while preserving the existing duration/error metrics.

How Has This Been Tested?

  • make linter_fix
  • make linter
  • make tests
  • make ts-typecheck
  • go test -mod=readonly ./... from cmd/xk6air
  • make build
  • git diff --check

Type of Changes

  • Bug fix
  • New feature
  • Documentation improvement
  • Refactoring
  • Other

Checklist

  • I have read the CONTRIBUTING.md
  • I have checked build and tests
  • I have updated documentation if needed

@Cianidos Cianidos merged commit 0e40550 into main Apr 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant