Search code examples
playwrightload-testingartillery

Artillery Playwright Not Capturing Specified Metrics


I am using Artillery with Playwright to measure performance metrics of a website, but I am not getting the metrics I specified in the configuration. Instead, I am seeing only browser-related metrics.

My Artillery Configuration:

import { Page } from "@playwright/test";

export const config = {
  target: "https://www.artillery.io",
  defaults: {
    capture: {
      response: ["status_code", "latency"],
      metrics: [
        "http.response_time.p50",
        "http.response_time.p95",
        "http.response_time.p99",
         "http.response_time.min",
         "http.response_time.max",
        "http.request_rate",
        "http.codes.200",
        "http.codes.4xx",
        "http.codes.5xx",
      ],
    },
  },
  plugins: {
    expect: { enabled: true },
    ensure: {
      thresholds: {
        "browser.page.TTFB.https://www.artillery.io/": { p95: 100 },
        "vusers.session_length.min": 1000,
        "browser.page.codes.404": 0,
      },
    },
  },
  engines: {
    playwright: { showAllPageMetrics: false },
  },
  phases: [{ duration: 10, arrivalRate: 1, name: "Usersarrival" }],
};

export const scenarios = [
  {
    engine: "playwright",
    testFunction: helloWorld,
  },
];

export async function helloWorld(page: Page) {
  await page.goto("https://www.artillery.io/");
  await page.click("text=Docs");
}

Issue: I expected to see http.response_time.p50, http.response_time.p95, etc., in my report. However, when I run the test, I only get browser-level metrics:

browser.page.TTFB.https://www.artillery.io/: min: 49.7, max: 111, p95: 63.4 browser.page.FCP.https://www.artillery.io/: min: 348.7, max: 921.8, p95: 528.6 browser.page.codes.200: 580 browser.page.codes.404: 10 vusers.session_length: min: 717.4, max: 2245.9, p95: 1353.1

Can someone please help me with this?


Solution

  • Setting config.defaults.capture has no effect as it's not a recognized configuration option for Artillery. (It looks like it was possibly suggested by an AI copilot?)

    You're not seeing http.-prefixed metrics you've defined in that block because Playwright-based tests don't capture those metrics. You can see the list of metrics reported by those tests in the official docs here: https://www.artillery.io/docs/reference/engines/playwright#metrics-reported-by-the-engine