Hi,
Have created a couple scenarios, and while this is working fine i do miss metrics per each scenario.
Made an attempt to read your docs where you suggest setting tags but have not go into the details on how to actually use them in a multi scenario situation (see tags-and-groups#tags).
However output is not helpful as it all newly created metrics, do contain same data.
import http from 'k6/http';
import { check, sleep } from 'k6';
import { Trend } from 'k6/metrics';
let myTrend1506 = new Trend('my_trend_1506');
let myTrend603 = new Trend('my_trend_603');
let myTrend83 = new Trend('my_trend_83');
export let options = {
scenarios: {
GET_1506_Bookings: {
executor: 'constant-vus',
vus: 10,
duration: '30s',
gracefulStop: '20s',
exec: 'liveResSearchGetBookings',
tags: { my_tag: 'GET_1506_Bookings' },
env: { DATE_SEARCH: '2020-10-29' },
},
GET_603_Bookings: {
executor: 'constant-vus',
vus: 30,
duration: '30s',
gracefulStop: '20s',
exec: 'liveResSearchGetBookings',
tags: { my_tag: 'GET_603_Bookings' },
env: { DATE_SEARCH: '2020-11-25' },
},
GET_83_Bookings: {
executor: 'constant-vus',
vus: 60,
duration: '30s',
gracefulStop: '20s',
exec: 'liveResSearchGetBookings',
tags: { my_tag: 'GET_83_Bookings' },
env: { DATE_SEARCH: '2020-05-20' },
},
},
}
export function setup() {
const headers = { 'Content-Type': 'application/json' };
let request_body = {
"username": "username",
"password": "password"
}
let auth_api = "token_url"
let res = http.post(auth_api, request_body, headers);
return { data: res.accessToken };
}
export function liveResSearchGetBookings(data) {
const options = {
headers: {
Authorization: `Bearer ${data}`,
},
};
let hostUrl = 'https://host_url'
let searchUrl = `/api/v1/events/search?page=1&pageSize=100&arrivalMin=${__ENV.DATE_SEARCH}`
let theCall = http.get(hostUrl+searchUrl, options);
check(theCall, {
'status is 200': (r) => r.status === 200
});
myTrend1506.add(theCall.timings.duration, { my_tag: 'GET_1506_Bookings' });
myTrend603.add(theCall.timings.duration, { my_tag: 'GET_603_Bookings' });
myTrend83.add(theCall.timings.duration, { my_tag: 'GET_83_Bookings' });
sleep(1);
}
The additional metrics in report are:
my_trend_1506…: avg=129.301266 min=41.9415 med=73.4241 max=970.1515 p(90)=295.72646 p(95)=403.93271
my_trend_603…: avg=129.301266 min=41.9415 med=73.4241 max=970.1515 p(90)=295.72646 p(95)=403.93271
my_trend_83…: avg=129.301266 min=41.9415 med=73.4241 max=970.1515 p(90)=295.72646 p(95)=403.93271
The goal is to retrieve metrics unique to each scenario.
Any help / suggestion is appreciated