cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DQL matcher in business events

Ellery
Helper

Hello, how do you use "DQL matcher in business events" when it is necessary to compare a number?

for example:

Ellery_0-1703628710862.png

and "matchesPhrase(toString(step), "1002")" works 

Ellery_1-1703628795094.png

 

but

Ellery_2-1703628849183.png

 

 

5 REPLIES 5

cesarsaravia
Dynatrace Pro
Dynatrace Pro

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:

cesarsaravia_0-1703632200572.png

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.

-César S. - LATAM Solutions Architect

This works excellently in LOGS and Event

s, Ellery_0-1703642219784.png

but when we go to "Business event metric extraction"

Ellery_1-1703642351766.png

in this only acepts matchesPhrase and matchesValue

 

 

 

 

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! 

The only constant is change. Finding ways for great things to happen!

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.

Featured Posts