-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move plugin-related utilities and API to SDK/tracer #3166
Conversation
…racer module (if functional).
…limited scope in plugins directly.
👋 @raphw Thanks a lot for your contribution! It may take some time before we review a PR, so even if you don’t see activity for some time, it does not mean that we have forgotten about it. Every once in a while we go through a process of prioritization, after which we are focussing on the tasks that were planned for the upcoming milestone. The prioritization status is typically reflected through the PR labels. It could be pending triage, a candidate for a future milestone, or have a target milestone set to it. |
❕ Build Aborted
Expand to view the summary
Build stats
Steps errors
Expand to view the steps failures
|
# Conflicts: # apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpan.java # apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/src/main/java/co/elastic/apm/agent/cassandra3/Cassandra3Instrumentation.java # apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/src/main/java/co/elastic/apm/agent/cassandra4/Cassandra4Instrumentation.java # apm-agent-plugins/apm-dubbo-plugin/src/main/java/co/elastic/apm/agent/dubbo/advice/ApacheMonitorFilterAdvice.java # apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java
I resolved the import conflicts. @SylvainJuge - did you have time to review? Almost there! |
Hi @raphw , thanks for keeping this PR up-to-date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another great refactor, thanks for this @raphw !
I think it's mostly fine to merge, and I only have very minor comments.
The extra indirection with service providers seems a bit overkill, but I don't think we have a better way to implement that without exposing implementation details from the core module to the plugins sdk, so I think it's fine. As it's only a few static methods maybe having a single provider/implementation could maybe simplify it a bit, but that would just group unrelated methods together in a single interface.
...agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/CustomElementMatchers.java
Show resolved
Hide resolved
apm-agent-plugin-sdk/src/test/java/co/elastic/apm/agent/sdk/util/PrivilegedActionUtilsTest.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bbwarmup/WarmupInstrumentation.java
Outdated
Show resolved
Hide resolved
LGTM as well, I just noticed that a lot of stuff has been moved into the sdk-project, which is intended to be used as public api for external plugins. And regarding the |
we shouldn't be expanding the public API at all, as it's intended to be deprecated in favour of the OpenTelemetry API |
The premise was that it should be possible to implement Elastic's plugins with the SDK and tracer APIs. As some of the APIs build on top of the current SDK, this was the only way to go. Another option would be to define a sdk-ext module which houses these extensions and to declare them not safe for public use. If one wanted to make these classes available later, they could still be moved to the non-ext module. |
I think we need to distinguish between the API used for creating spans (=opentelemetry or our "public API") vs the API required for defining the bootstraping of the external plugin, e.g. |
I think that would be a bit overkill and add yet another module, of which we already have plenty 😅 . Therefore my suggestion to mark them as not intended for public uses by moving them to an |
In Mockito, we use an |
We decided to go with just the |
run elasticsearch-ci/docs |
This API separates API that is mainly used within plugins from the core module but makes it available via the tracer-api (if functional) or the sdk module (if technical). The scope of the latter can be discussed as this exposes it to user plugins, but I found that there are several legitimate uses of some of the Byte Buddy extensions (several custom annotations and matchers) from within non-built-in-plugins. This is also true for several util classes which are mainly used from plugins where technical utilities are moved to the SDK and functional utilities are moved to the tracer module. Also, the
PluginClassLoaderRootPackageCustomizer
is moved to the SDK (the question being if it should be exposed, but I think there are use cases). Finally, theTraceAwareInstrumentation
class is removed as it creates an unfortunate binding between the SDK and tracer module which does not otherwise exist elsewhere. By removing this class, the two modules can remain separated.