26 Dec 2023 10:14 PM - last edited on 28 Dec 2023 01:26 PM by Ana_Kuzmenchuk
Hello, how do you use "DQL matcher in business events" when it is necessary to compare a number?
for example:
and "matchesPhrase(toString(step), "1002")" works
but
Solved! Go to Solution.
26 Dec 2023 11:12 PM
Hi @Ellery
You should convert the string field "step" to double. You can use toDouble() function to convert to numbers with decimals, because your data is pure string.
Here you have an example:
data
record(timestamp=now()-1m, severity="INFO", event="search successful", number= "10"),
record(timestamp=now()-1m, severity="INFO", event="search successful", number= "10.1"),
record(timestamp=now(), severity="ERROR", event="failed to find product", number= "15.5"),
record(timestamp=now()-1m, severity="INFO", event="search successful", number= "15.6"),
record(timestamp=now(), severity="ERROR", event="failed to find product", number= "5.4")
| filter toDouble(number)>=10 and toDouble(number) <= 20.9
| fieldsAdd success=if(contains(event,"success"),true)
BR,
-Cesar S.
27 Dec 2023 02:01 AM - edited 27 Dec 2023 02:01 AM
This works excellently in LOGS and Event
s,
but when we go to "Business event metric extraction"
in this only acepts matchesPhrase and matchesValue
27 Dec 2023 02:23 AM
i found the solution, almost acepts "==" equals for numbers
the query it's "matchesPhrase(event.type, "resultado admision") and matchesPhrase(event.provider, "prod.salud.achs.cl") and (step == 1002 or step == 1002.1 or step == 1002.2 or step == 1002.3 or step == 1002.4 or step == 1002.5)"
28 Dec 2023 01:25 PM
Thank you for sharing your findings with the Community; highly appreciated!
11 Apr 2024 12:07 PM - edited 11 Apr 2024 12:12 PM
I find that useful, however, I don't feel like adding 100 ors in case, of, f.e. a response code, 5xx, I did something different:
Captured the response normally, then added a new field of the converted response code to a string in Processing with
FIELDS_ADD(rescodeString:""+rescode)
and added a filter to the business event metric capture:
matchesValue(rescodeString,"5*")
Probably, there is a better option to do this.
But replacing DQL Matchers with actual DQL would be the best, since It is practically unusable.