Can I use a variable in a threshold and page tag?

I have a switch statement that selects one of about 20 APIs, can I configure a threshold with a variable and then the tag on the request parms to send a value for the threshold http_req_duration. metric

eg something like this in the init
page:auth is always called first
page:${pageTag} could be on of 20 different APIs, only one ever runs at a time

thresholds: {
    'http_req_duration{page:auth}': ['p(95)<200'],
    `http_req_duration{page:${pageTag}}`: ['p(95)<100']
}

Then in my PUT on each event assign a value to a variable then return tag page as that variable

var event = 'event_type'

const headers = { 
        'Content-Type': 'application/json', 'Authorization': `auth here`}
    let response = http.put(`unique api call goes here/`,
        JSON.stringify(eventList), { 
            headers,
            tags: {
              page: event
          },
      });

Is this possible so that my threshold config only needs one event duration output and the 20 events logic controls what to show?

Hopefully this makes sense, please ask questions if it does not.

Hi @sm123, Welcome to the community forum :tada:

I see no problem with this except that the variable pageTag needs to be defined in both cases when you use it.

Have you tried it and there were problems?

Yeah tried it many ways and it does not work.

Cannot see any tutorials anywhere to be able to do it either.

It looks like you need to add a line for each type in the thresholds