Simplify DynamicTransformer API#2164
Conversation
Instead of DynamicTransformer.Accessor.get().ensureInstrumented, users can just call DynamicTransformer.ensureInstrumented
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
eyalkoren
left a comment
There was a problem hiding this comment.
LGTM, only a minor naming suggestion
| transformer.ensureInstrumented(classToInstrument, instrumentationClasses); | ||
| } | ||
|
|
||
| public interface DynamicTransformerSupplier { |
There was a problem hiding this comment.
[minor] I don't think DynamicTransformerSupplier is a good name for this interface. I would call it DynamicTransformer and find a better name for the declaring class, even StaticDynamicTransformer, but preferably something better 🙂
There was a problem hiding this comment.
I agree that the name of the interface isn't ideal. But I wanted to optimize for the actual user facing class which is DynamicTransformer. While DynamicTransformerSupplier needs to be public, users never really get to see it. Also, it's in line with WeakConcurrentSupplier.
There was a problem hiding this comment.
It's just that DynamicTransformer doesn't supply anything (as opposed to the weak map supplier).
What about RuntimeInstrumentor for the interface?
And an additional suggestion - I just noticed that ignore this one, it's static in DynamicTransformerImpl seems redundant, why not make ElasticApmAgent the service provider implementing the interface (whatever it's called 🙂 ).ElasticApmAgent
Either way, feel free to ignore both suggestions and merge if you disagree. It's not that important.
What does this PR do?
Instead of
DynamicTransformer.Accessor.get().ensureInstrumented,users can just callDynamicTransformer.ensureInstrumentedMakes the API similar in style to the recent changes in
WeakConcurrent.Checklist