You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a browser test, and navigating to a site (e.g. https://test.k6.io) if the trailing "/" is missing, chrome will add it. All metrics that are associated to that navigation will work with the amended address with the trailing "/" (e.g. https://test.k6.io/). This can be problematic when working with thresholds, since the user may not add the trailing "/" (e.g. thresholds: { 'browser_web_vital_lcp{url:https://test.k6.io}': ['p(95) < 2000'] }) which will mean that k6 will not be able to correlate the metrics with the thresholds. The end result will mean that the threshold value will be incorrect.
k6 version
NA
OS
NA
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Run the following:
import{browser}from'k6/browser';import{check,sleep}from'k6';exportconstoptions={scenarios: {FsFacility: {executor: 'per-vu-iterations',vus: 1,iterations: 1,options: {browser: {type: 'chromium',},},},},thresholds: {'browser_web_vital_lcp{url:https://test.k6.io}': ['p(95) < 2000'],},};exportdefaultasyncfunction(){constcontext=awaitbrowser.newContext();constpage=awaitcontext.newPage();try{awaitpage.goto('https://test.k6.io');sleep(10);// Allows time to capture LCP and other web vitals}finally{awaitpage.close();}}
It's possible to hit this issue when the page redirects to another page. E.g. when navigating to your grafana stack (some-name.grafana.com), it will redirect to the login page first. In some cases it may not redirect back to the initial page. The thresholds will not correlate due to the redirects. It currently requires the user to know up front all the possible urls that the test will navigate to and adding the thresholds in for each url, e.g.:
Brief summary
When running a browser test, and navigating to a site (e.g. https://test.k6.io) if the trailing "/" is missing, chrome will add it. All metrics that are associated to that navigation will work with the amended address with the trailing "/" (e.g. https://test.k6.io/). This can be problematic when working with thresholds, since the user may not add the trailing "/" (e.g.
thresholds: { 'browser_web_vital_lcp{url:https://test.k6.io}': ['p(95) < 2000'] }
) which will mean that k6 will not be able to correlate the metrics with the thresholds. The end result will mean that the threshold value will be incorrect.k6 version
NA
OS
NA
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Which will result in:
Changing the threshold to:
Fixes the issue.
Expected behaviour
The threshold correlates with the metric regardless of the missing trailing "/".
Actual behaviour
The threshold doesn't correlate with the metric when it is missing the trailing "/".
The text was updated successfully, but these errors were encountered: