Available Outputs
Summary Output
The default output that displays test results in the terminal at the end of the test.CSV Output
Export metrics to CSV files for analysis in spreadsheet applications.internal/output/csv/output.go:21) writes metrics with the following structure:
- Metric name
- Timestamp
- Metric value
- All tags as separate columns
CSV output supports gzip compression automatically when the filename ends with
.gz:Cloud Output
Stream results to Grafana Cloud k6 for real-time analysis and collaboration.InfluxDB Output
Send metrics directly to InfluxDB v1 for time-series storage and visualization.internal/output/influxdb/output.go:37) supports:
- Configurable batch sizes
- Concurrent writes for better performance
- Tag-to-field conversions
- Custom precision settings
OpenTelemetry Output
Export metrics using the OpenTelemetry protocol (OTLP) for integration with observability platforms.Prometheus Remote Write
Send metrics to Prometheus-compatible systems using the remote write protocol.Using Multiple Outputs
You can specify multiple outputs to send results to different destinations:Output Configuration
All outputs can be configured via:- Command-line flags:
--out format=config - Environment variables:
K6_OUT=format=config - Test script options: Using the
extconfiguration object - JSON configuration: Via the
--configflag
Priority Order
Configuration sources are applied in this order (later overrides earlier):- Default values
- JSON configuration file
- Script options
- Environment variables
- Command-line arguments
Output Interface
All outputs implement theOutput interface (output/types.go:44) with these methods:
Description(): Human-readable output descriptionStart(): Initialize the output and start background processingAddMetricSamples(): Receive metric samples (non-blocking)Stop(): Flush remaining metrics and clean up resources
Outputs should use non-blocking
AddMetricSamples() methods and buffer metrics for asynchronous flushing to avoid impacting test performance.Output Extensions
k6 supports custom output formats through extensions. See Creating Custom Outputs for building your own output plugin. Popular community extensions:- xk6-output-influxdb: InfluxDB v2 support
- xk6-output-prometheus-remote: Enhanced Prometheus integration
- xk6-output-kafka: Stream to Apache Kafka
- xk6-output-timescaledb: Direct TimescaleDB output