28 Nov 2021 04:01 PM - last edited on 29 Nov 2021 10:26 AM by MaciejNeumann
Hi All,
I need your wisdom in regular expressions and Dynatrace:
We have a situation in which an application is calling a third party, receiving all responses as 200 OK, but in a numeric field there could be different values to mark the completion status of the request. Unfortunately, there are several values that can mark it as succeeded and several to mark it as failed. We want to try and create a request attribute that will show us whether something have failed. Unfortunately, we only know which values are successful, and these are 0 and 9007 (Don't ask me about this choice of values please).
I've been trying to play with further processing of the RA in order to indentify those with different values, but the 9007 is failing me over and over again.
Is this doable at all? Can you assist?
Gil.
Solved! Go to Solution.
30 Nov 2021 01:54 PM
At this point in time I don't think it is. I can see the Response Code under the Purepath Metadata, but within the Request Attribute settings, I don't see where we can isolate that and use it as a Request Attribute.
You would need to put in a RFE to possibly gain this feature in the product.
01 Dec 2021 06:15 AM
Hi @ChadTurner ,
I must have mis-explained myself.
I'm not interested in the http response code, but in a parameter value that is returned from a function. I am able to collect this "raw" code.
The challenge here is that it can have different values that are expressing "good" execution and multiple values that express "failed" executions. I'm trying to find a regex that will set a request attribute to mark the failure if the value is not equal to one of several values. problem is that the values are numbers, some of them are with multiple digits (for example two valid codes are 0 and 9007).
Hope this is better understood.
01 Dec 2021 05:03 PM
Hi @gilgi ,
Try using negative lookahead (https://www.regular-expressions.info/lookaround.html). Something like this should work (I've only tested it in the UI):
^(?!^9007$|^0$)\d*+$
So here we're basically telling the engine to parse any digit(s) that are not 9007 or 0. Also, be sure to prune whitespaces with this one.
01 Dec 2021 07:19 PM
Try this one too and let’s see the outcome.
(^(?!(?!^9007$|^0$)))
i.e., strictly starting with “9007” or “0” in the response with space insensitive.