-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
This proposal suggests establishing a standardized naming convention—specifically the x- prefix—for Output Extensions in k6.
Currently, the k6 extension ecosystem enforces namespaces for other extension types to distinguish them from core functionality:
- JS Extensions: Import paths must strictly start with
k6/x/(e.g.,import ... from 'k6/x/sql'). - Subcommand Extensions: Must be invoked via the
xsubcommand (e.g.,k6 x my-cmd).
However, Output Extensions currently share the global namespace with built-in outputs. A custom output is registered and invoked exactly like a native one (e.g., --out kafka vs --out influxdb).
Proposal
Enforce or strongly recommend that Output Extensions register their names using an x- prefix.
Example:
# Current state (Ambiguous)
k6 run --out kafka=...
# Proposed state (Explicit)
k6 run --out x-kafka=...Motivation & Benefits
-
Consistency across the Extension Ecosystem
Aligning Output Extensions with the existingk6/x/(JS) andk6 x(Subcommand) patterns creates a cohesive developer experience. It makes it immediately obvious to the end-user which parts of their stack are provided by the core binary and which are provided by extensions. -
Conflict Prevention & Future-Proofing
Currently, if an extension registers a generic name (e.g.,kafka,sql,redis) and k6 core later introduces a native output with the same name, it creates a breaking conflict. Reserving thex-namespace for extensions guarantees that community contributions will never clash with future built-in k6 outputs. -
Enabling Automatic Extension Resolution
This is a critical enabler for future tooling improvements. By enforcing a prefix, tools (or k6 itself) can programmatically distinguish between a typo and a missing extension.- Scenario A: User types
--out ifluxdb(missing 'n'). The system sees nox-prefix, recognizes it as an attempt to use a core output, and errors with "Unknown output 'ifluxdb', did you mean 'influxdb'?". - Scenario B: User types
--out x-custom-sink. The system detects thex-prefix, identifies it as an extension, and can trigger automatic extension resolution.
- Scenario A: User types
Without this distinction, automatic resolution logic is risky as it might attempt to resolve typos as external packages.