Wildcard for metric name

Hi, community!

In my K6 project I have a lot of checks to verify status code = 200, ‘errors’ in the response body and etc., using k6chaijs library. And have a DataDog integration to display my metric in the dashboard. So, my question is any option to declare one check metric using a wild card e.g:

“query”: “sum:k6.check.expected_{*}.fail{*}.as_count()”

VS to declare each metric from my project
“query”: “sum:k6.check.expected_response_status_to_equal_200.fail{*}.as_count()”
“query”: “sum:k6.check.expected_response_to_not_include_faultcode.fail{*}.as_count()”
“query”: “sum:k6.check.expected_response_to_not_include_error.fail{*}.as_count()”

Hi @Dmytro

Thanks for opening this topic.

Do you want to avoid declaring all the checks in the k6 scripts, using a wildcard instead? Or are you referring to the wildcard filter in DataDog not working for the metrics k6 is sending?

I understand you are using the DataDog output and the k6chaijs for the checks, is that correct? If you can share a sample of your k6 scripts, and what you’d like to have, I might understand your context better and we can check if it’s doable or we’d need to implement a feature for that.

Thanks in advance!

1 Like

Hi @eyeveebe, thank you for the replay!

My idea is to declare all ‘check*’ using a wildcard in the metric, in other words, replaces all ‘check*’. Not in metric query, but specifically in metrics.

In my scripts, I have several metrics which verify response from the server

Could I replace all this metrics with one wild card metric?
e.g
k6.check.expected{my_wild_card_metric}.fail