We have a method that we've instrumented. It has the following signature:
retrieveSearchResults(java.lang.Object payload, java.lang.Boolean isAutoComplete)
Is it possible to only instrument the method or only capture argument / return details if isAutoComplete = false? This method fires as part of a search, and that search has autocomplete functionality. I don't care about autocomplete search results, only "hard coded" searches. This should reduce the method instrumentation / transformation regex (see below) from approximately 20,000 fires a day, to about 2,000 fires a day.
We're capturing method arguments as well as return values perfectly fine. Our goal is to capture the passed search parameters along with their results. That's also working fine, via Business Transaction splittings of Argument Value / Return Value.
However, this involves a transformation regex, and while I've optimized the regex as much as possible, I'd still like to avoid additional overhead of all of those autocompletes.
Answer by Joseph H. ·
Cesar, In order to evaluate the boolean, we need to instrument the method. So at that point, we've already taken the cost to capture, so you might as well keep the data. It actually costs more overhead to put logic into the agent to conditionally capture, then capture all the time. I'm not sure why you need a regex, but if that's being evaluated on the dTServer I wouldn't worry about the overhead, 20k/day isn't really that much. But I do like your approach and awareness that RegEx can be an expensive operation and to use only when necessary.
If the Regex is on the instrumentation rules, realize that is only involved during bytecode instrumentation at class loading time, not at method execution time, again a much less concern than if being evaluated for every execution.