How to use the k6/metrics.Counter function in k6

To help you get started, we’ve selected a few k6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StarpTech / fay / loadtesting / html.js View on Github external
import http from "k6/http";
import { Counter } from "k6/metrics";
import { check } from "k6";

let headerFile = open("../example/header.html", "b");
let pageFile = open("../example/page.html", "b");

let failCounter = new Counter("failed requests");

export let options = {
  stages: [{ duration: __ENV.DURATION || "5m", target: __ENV.MAX_VUS }],
  thresholds: {
    "failed requests": [
      {
        threshold: "count<1",
        abortOnFail: true,
      },
    ],
  },
};

export default function () {
  let data = {
    headerTemplate: http.file(headerFile, "header.html"),
github StarpTech / fay / loadtesting / url.js View on Github external
import http from "k6/http";
import { Counter } from "k6/metrics";
import { check } from "k6";

let headerFile = open("../example/header.html", "b");

let failCounter = new Counter("failed requests");

export let options = {
  stages: [{ duration: "5m", target: __ENV.MAX_VUS }],
  thresholds: {
    "failed requests": [
      {
        threshold: "count<1",
        abortOnFail: true,
      },
    ],
  },
};

export default function () {
  let data = {
    headerTemplate: http.file(headerFile, "header.html"),