JSON Data And Graphing

Hello,

Let’s say I have a test with the following options below. I run it with a --out json=file. How do I know which http_req_duration metrics were started in which stage? I know there’s a data.time measure, but that seems like it would be stamped for the end of the measure?

export const options = {
  stages: [
    { duration: "30s", target: 25 },
    { duration: "15m", target: 25 },
    { duration: "30s", target: 50 },
    { duration: "15m", target: 50 },
    { duration: "30s", target: 75 },
    { duration: "15m", target: 75 },
    { duration: "30s", target: 100 },
    { duration: "15m", target: 100 },
    { duration: "30s", target: 125 },
    { duration: "15m", target: 125 },
    { duration: "30s", target: 150 },
    { duration: "15m", target: 150 },
    { duration: "30s", target: 175 },
    { duration: "15m", target: 175 },
    { duration: "30s", target: 200 },
    { duration: "15m", target: 200 },
  ],
  thresholds: {
    http_req_duration: ["p(99) < 1000", "p(95) < 700"], // 99% of requests must complete below 1s, 95% below 0.7s
    http_req_failed: ["rate<0.01"], // http errors should be less than 1%
  },
};

Yes, the timestamp in every metric sample is the time it is measured, after the request is done. To get the start time, you just have to subtract the http_req_duration value itself from that time, plus http_req_connecting and http_req_tls_handshaking.

Alternatively, you can add a custom tag for every metric sample with the stage that generated it. See here for how it can be done for all metrics in an iteration. If you just call tagWithCurrentStageIndex() before every request though, that will tag individual requests with the stage in which they were started.

1 Like

Great! Thanks for confirming my suspicions. And, yes, that util is exactly what I wanted.