dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

[EXPERIMENTAL] IAST Callback reloader

Open anderruiz opened this issue 3 years ago • 1 comments

What Does This Do

Includes the ability to reload InstrumentationBridge replacing it with an empty implementation to short-circuit the calls

Motivation

Being able to short circuit the IAST calls is interesting, both in case of an error but also to do remote activation

Additional Notes

This is an experimental branch. Not meant to be merged.

anderruiz avatar Jul 23 '22 07:07 anderruiz

I understand the desire to short-circuit the calls, but I'd like to understand why we've chosen this approach to do it.

I see that the callback only takes Strings. That's good because otherwise I'd be concerned by the cost of constructing parameters of the calling side -- and we need a different mechanism anyway.

However given what we're trying to do here, I think there are a couple possibly simpler options. 1 - We can short-circuit via boolean switch 2 - We can dynamic dispatch to nop implementation

Those both rely on the JVMs speculative optimization, but I'm curious if we've benchmarked our options before settling on bytecode manipulation. But relying on redefinition has the same downsides. Redefinition will result in a stop the world pause and surge of recompilation. Depending on the specifics that's also true for dynamic dispatch, but can easily be avoided.

The simple solution of boolean still leads to deoptimization, but not of the stop the world variety.

Before introducing such mechanisms into the code base, it would nice if the approach was discussed with a larger audience first.

dougqh avatar Aug 02 '22 13:08 dougqh