elastic / elastic/apm-agent-java

Revisit the ensureInstrumented flow

Open
#1,485 1 comment 0 reactions 0 assignees View on GitHub
technical-debt
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.