k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Comma character in the url causes parsing issue, so it's not possible to use url containing comma for threshold expression

Open ArturSuchowierski opened this issue 2 years ago • 1 comments

Brief summary

Following example of threshold for URL will run into error: ERRO [0000] unable to validate threshold expressions; reason: parsing metric name failed, metric "cde" tag expression is malformed

export const options = { thresholds: { ‘webvital_largest_content_paint{url:www.example-url.com/somepage?abc,cde,def}’ : [‘p(90) < 2500’], }, },

Maybe it's worth checking even for other characters, that might be allowed in the URL's

k6 version

v0.45.0

OS

macOS Ventura 13.4.1

Docker version and image (if applicable)

n/a

Steps to reproduce the problem

Run any test for following threshold:

export const options = {
  thresholds: {
    ‘webvital_largest_content_paint{url:www.example-url.com/somepage?abc,cde,def}’ : [‘p(90) < 2500’],
  },
 },

Expected behaviour

Url including commas should be properly parsed for the threshold

Actual behaviour

When running test there's error returned: ERRO [0000] unable to validate threshold expressions; reason: parsing metric name failed, metric "cde" tag expression is malformed

ArturSuchowierski avatar Jul 06 '23 09:07 ArturSuchowierski

Hi @ArturSuchowierski

Sorry for the late response :cry:

Yes, unfortunately, I can only confirm the fact that the comma there could cause the issue for the threshold parser since it tries to tread cde as the metric. As @mstoykov mentioned to you in another issue, it's due to the fact that the current threshold syntax, format, and functionality is kind of basic.

It seems like the proper solution for the issue is to keep such a case in mind during the implementation of a bigger thing like https://github.com/grafana/k6/issues/3198.

olegbespalov avatar Aug 22 '23 13:08 olegbespalov