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
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.
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)”
Thank you for sharing your findings with the Community; highly appreciated!
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.