Can I initialize load metrics with the same type using list or dictionary?

Hello, guys!

I need to track metrics for several methods with the same Trend type. How can i initialize it using list or dictionary?

export let allSportsDuration = new Trend("all_sports_duration");
export let eventDetailsDuration = new Trend("event_details_duration");
export let eventExternalInfoDuration = new Trend("event_external_info_duration");
export let eventsDuration = new Trend("events_duration");
export let favouritesChampsDuration = new Trend("favourites_champs_duration");
export let highlightsDuration = new Trend("highlights_duration");
export let liveEventsDuration = new Trend("live_events_duration");
export let liveNowDuration = new Trend("live_now_duration");

Hi @Daniil,

sorry for the late response.

I’m not sure what you’re trying to do, but maybe something like this?:

const metricNames = [

let metrics = {};

for (let m of metricNames) {
  metrics[m] = new Trend(m);

Using it would be a bit awkward, though:

export default function () {
  let r = http.get('');