From 965dcdcbe718a6ce9a06b2ea515544b136b6a5ef Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 25 Jan 2024 09:59:09 +0300 Subject: [PATCH] [#119] scenarios: Add `Metrics export` section to docs Signed-off-by: Dmitrii Stepanov --- scenarios/run_scenarios.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scenarios/run_scenarios.md b/scenarios/run_scenarios.md index e3d38e5..f2c0332 100644 --- a/scenarios/run_scenarios.md +++ b/scenarios/run_scenarios.md @@ -187,6 +187,21 @@ Options (in addition to the common options): * `OBJ_NAME` - if specified, this name will be used for all write operations instead of random generation. * `MAX_TOTAL_SIZE_GB` - if specified, max payload size in GB of the storage engine. If the storage engine is already full, no new objects will be saved. +## Export metrics + +To export metrics to Prometheus (also Grafana and Victoria Metrics support Prometheus format), you need to run `k6` with an option `-o experimental-prometheus-rw` and +an environment variable `K6_PROMETHEUS_RW_SERVER_URL` whose value corresponds to the URL for the remote write endpoint. +To specify percentiles for trend metrics, use an environment variable `K6_PROMETHEUS_RW_TREND_STATS`. +See [k6 docs](https://k6.io/docs/results-output/real-time/prometheus-remote-write/) for a list of all possible options. +To distinct metrics from different loaders, use an option `METRIC_TAGS`. These tags does not apply to builtin `k6` metrics. + +Example: +```bash +K6_PROMETHEUS_RW_SERVER_URL=http://host:8428/api/v1/write \ +K6_PROMETHEUS_RW_TREND_STATS="p(95),p(99),min,max" \ +./k6 run ... -o experimental-prometheus-rw -e METRIC_TAGS="instance:server1;run:run1" scenario.js +``` + ## Verify This scenario allows to verify that objects created by a previous run are really stored in the system and their data is not corrupted. Running this scenario assumes that you've already run gRPC or HTTP or S3 scenario with option `REGISTRY_FILE`.