Configure real-time streaming and degradation thresholds

On a multi-hour production soak, the most useful signal often appears mid-run: latency that slopes upward, errors that start after a clean warm-up, or throughput that drops at constant VUs. Streaming results to Grafana Cloud k6 lets you watch those trends while the test runs instead of waiting for the final summary.

To configure streaming and degradation thresholds, complete the following steps:

  1. Update your soak.js thresholds to use abortOnFail with delayAbortEval:

    Replace the thresholds block in your options with the following:

    JavaScript
    thresholds: {
      http_req_duration: [
        {
          threshold: 'p(95)<500',
          abortOnFail: true,
          delayAbortEval: '3m',
        },
      ],
      http_req_failed: [
        {
          threshold: 'rate<0.01',
          abortOnFail: true,
          delayAbortEval: '3m',
        },
      ],
    },

    delayAbortEval: '3m' skips threshold evaluation for the first three minutes so warm-up (JIT, caches, connection pools) does not trigger a false abort on this 30-minute learning run. After that window, k6 aborts if p95 exceeds 500 ms or the error rate exceeds 1%. For multi-hour production soaks, use delayAbortEval: '10m' or longer so warm-up does not consume too much of a short learning run.

  2. If you haven’t authenticated with Grafana Cloud k6, log in from the CLI:

    Bash
    k6 cloud login --token <YOUR_API_TOKEN> --stack <YOUR_STACK_SLUG_OR_URL>

    In Grafana Cloud, go to Testing & synthetics > Performance > Settings. Under Access, copy your Personal token or Stack token. For --stack, pass your stack URL slug or full stack URL (for example my-team or https://my-team.grafana.net). Refer to Authenticate on the CLI.

  3. Preview what you’ll monitor when the test runs.

    Thresholds catch hard breaches, but Grafana Cloud timelines show gradual drift. A p95 that climbs from 200 ms to 490 ms over two hours without crossing 500 ms is still a warning sign—watch the timeline for shape; thresholds are a backstop.

    After you start the soak in the next milestone with k6 cloud run --local-execution, open the Grafana Cloud k6 results URL and watch:

    • Response time trends: p95 latency that slopes upward over time, even if it stays below threshold
    • Error rate over time: errors that appear after sustained clean operation
    • Throughput (RPS): declining RPS at constant VU count

In the next milestone, you run the soak test with cloud streaming enabled and correlate k6 results with infrastructure metrics in Grafana.


page 4 of 8