elastic / elastic/apm-agent-java
Revisit the ensureInstrumented flow
- Dominant language
- Java
- Stars
- 594
- Forks
- 338
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 25
Description
See if we can improve the efficiency of `ElasticApmAgent#ensureInstrumented` and its use of `ElasticApmAgent#getAgentBuilder`: currently, we create an agent builder and class file transformer every time we invoke this flow for not-yet instrumented classes.
If we cache all transformers and know how to look them up properly, we can reduce some overhead. We can then use `net.bytebuddy.agent.builder.AgentBuilder#patchOn` to apply instrumentation diffs.
In addition, the caching is currently based on a hash of the instrumentation classes set. It is probably better to change it to be on a constant hash that relies on the instrumentation/advice class names.
Contributor guide
Assessment
This issue has not been assessed yet.