Separate metrics summary for each request in default function

I am sending 4 requests to test a service: create, update, read, and delete. All requests work well in sequence. The summary that is generated at the end is for all the requests combined. The times for the 4 requests are averaged. Is there a way I can see the average response times for create requests separate from other 3 requests? I am finding it difficult to understand the output.
Am I doing it wrong? Should I be creating separate scripts for all 4 requests?


The summary aggregates all of the results it shows. The only current way to get around that, before we implement Add explicit tracking and ignoring of metrics and sub-metrics · Issue #1321 · grafana/k6 · GitHub, is to define a threshold on a sub-metric. I gave an example for that in Ignore http calls made in Setup or Teardown in results? - #2 by nedyalko, but if I understand your use case correctly, it would be something like this:

import http from 'k6/http'

export let options = {
    vus: 5,
    duration: "10s",
    thresholds: {
        // Some dummy thresholds that are always going to pass. You don't even
        // need to have something here, I tried it and just this
        // `'http_req_duration{scenario:default}': []` is enough to trick
        // k6, but that's undefined behavior I can't promise we won't break
        // in the future...
        'http_req_duration{my_tag:create}': ['max>=0'],
        'http_req_duration{my_tag:read}': ['max>=0'],
        // You don't have to define custom tags, you can use any of the already defined
        // system tags:
        'http_req_duration{method:POST}': ['max>=0'],
        'http_req_duration{url:}': ['max>=0'],
        'http_req_duration{status:200}': ['max>=0'],

export default function () {'', null, { tags: { my_tag: 'create' } });
    http.get('', { tags: { my_tag: 'read' } });'', 'some body');

Alternatively, it might be better if you work with the raw metrics data directly by exporting it to JSON/CSV or sending it to InfluxDB or some other external service. You can see more details about that in Results output