Is it possible to overwrite the url tag in http request

Hello, I am wondering if it is possible to overwrite the default url tag k6 applies to each request. I am talking about this one:
“tags”: {
“method”:“GET”,
“name”:“PostsItemURL”,
“status”:“200”,
“url”:“http://example.com/2
}

Since we have a lot of APIs with path params and query params we don’t want every request to have a unique url in the prometheus metric.
I tried with providing, but it does not seem to work
“tags”: {
“url”: “address
}

Hi @eXpLoD96 !

I believe you’re looking for the option Options reference System tags. That way, you can disable the URL as the system tag and, if needed, pass any other value.

Let me know if that helps!
Cheers!

I tried that, but when I remove the url some of the grafana dashboards were breaking → the one where it shows average http req duratioon :thinking: , although it shouldn’t be connected to the url tag I believe?

That’s interesting. May I ask you which exact dashboard? :thinking:

although it shouldn’t be connected to the url tag I believe?

I guess so

We are using this one: k6 Load Testing Results (Prometheus) | Grafana Labs

I see.

It’s because this one is used URL for filtering URLs by the domain variable (dashboard variable):

avg(k6_http_req_${HttpMetricName}_avg{scenario=\"$scenario\",expected_response=\"true\", url=~\".*${domain}.*\"})

So I believe apart from disabling it from the system tag, some “domain” should be provided.

For example:

import { sleep } from "k6";
import http from "k6/http";

export const options = {
  systemTags: ['proto,subproto,status,method,name,group,check,error,error_code,tls_version,scenario,service,expected_response'],
};

export default function () {
  http.get('http://test.k6.io', { tags: { url: 'lorem.localhost' } });
  
  sleep(1);
} 

Let me know if that answers.
Cheers!

Yes, this works, thank you!