Output backends¶
rampa ships metric samples to output backends during and after a test run.
Use --output to send results to multiple destinations simultaneously.
Built-in backends¶
Backend |
Destination |
Dependencies |
|---|---|---|
|
Terminal summary (default) |
None |
|
JSON file |
None |
|
CSV file |
None |
|
InfluxDB HTTP API |
aiohttp (included) |
|
Prometheus remote write |
aiohttp; optional |
|
OpenTelemetry collector |
aiohttp (included) |
|
Any HTTP endpoint |
aiohttp (included) |
CLI usage¶
$ rampa run load_test.py --output csv=results.csv
Multiple outputs in one run:
$ rampa run load_test.py \
--output csv=results.csv \
--output influxdb=http://localhost:8086/api/v2/write?org=myorg&bucket=rampa
The --out flag is shorthand for --output json=<path>.
CSV¶
One row per sample. Tag keys become columns.
$ rampa run load_test.py --output csv=metrics.csv
Output:
timestamp,metric,value,method,scenario,status
1716691200,http_reqs,1.0,GET,smoke,200
1716691201,http_req_duration,45.2,GET,smoke,200
InfluxDB¶
Pushes samples as line protocol over HTTP.
$ rampa run load_test.py \
--output influxdb=http://localhost:8086/api/v2/write?org=myorg&bucket=rampa
Each sample becomes one line:
http_req_duration,method=GET,scenario=smoke value=45.2 1716691200000000000
Tags map to InfluxDB tags, the sample value maps to the value field,
and the monotonic nanosecond timestamp maps to the InfluxDB timestamp.
Prometheus¶
Pushes metrics to Prometheus via the remote write API. Uses hand-crafted
protobuf v1 encoding with snappy compression (falls back to gzip if
python-snappy is not installed).
$ rampa run load_test.py \
--output prometheus=http://localhost:9090/api/v1/write
Each sample becomes a Prometheus TimeSeries with __name__ set to the
metric name and sample tags as labels. Feeds Grafana dashboards directly.
Install python-snappy for optimal compression:
$ uv add python-snappy
OpenTelemetry¶
Exports metrics via OTLP/HTTP+JSON to any OpenTelemetry-compatible collector (Grafana Alloy, OTEL Collector, Jaeger, etc.). Zero additional dependencies.
$ rampa run load_test.py --output otel=http://localhost:4318
The /v1/metrics path is appended automatically. Uses the JSON wire
format (proto3 standard JSON mapping) — no protobuf compiler needed.
Webhook¶
POST sample batches as JSON to any HTTP endpoint.
$ rampa run load_test.py --output webhook=https://example.com/hook
Payload shape:
{
"samples": [
{"metric": "http_reqs", "value": 1.0, "timestamp": 1716691200, "tags": {"method": "GET"}}
]
}
Programmatic usage¶
from rampa.outputs import get_output
csv_out = get_output("csv", "results.csv")
influx_out = get_output("influxdb", "http://localhost:8086/api/v2/write")
All outputs implement the Output protocol:
start(), add_samples(batch), stop(error).