-
Notifications
You must be signed in to change notification settings - Fork 324
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
Factor out reference counting to explicit API #3081
Conversation
👋 @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. |
# Conflicts: # apm-agent-plugins/apm-urlconnection-plugin/src/main/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentation.java # apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java # apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java # apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java
# Conflicts: # apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java # apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/AbstractSpan.java
apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/reference/ReferenceCounter.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/collections/WeakMapReferenceCounter.java
Outdated
Show resolved
Hide resolved
apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java
Outdated
Show resolved
Hide resolved
...plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/ProcessHelperTest.java
Outdated
Show resolved
Hide resolved
I think leaving out the reference counting form the SDK is better for now: External plugins are written either based on OpenTelemetry or our our public tracing API which both don't support reference counting / recycling. For external plugins we accept that we might produce higher GC load (due to spans being GCd) instead of burdening the complexity of ref-counting on the users. |
run elasticsearch-ci/docs |
This change introduces an explicit API for reference counting to the tracer API. This avoids that plugins need to rely upon the
WeakConcurrentProviderImpl
which is part of agent-core.This solution is a suggestion, and it can be solved differently. For example, it would be possible to add the SDK as a dependency to the tracer API and to integrate this functionality via the current
WeakConcurrentProvider
. Doing so, theReferenceCounted
interface could be placed in the SDK and reference counting could be exposed via theWeakConcurrentProvider
. This would however make reference counting available via the SDK.Personally, I would prefer the latter solution. If there is a legitimate reason for reference counting in the internal plugins, there are surely legitimate reasons to use them in user plugins. Also, users choose their own knives to cut themselves with, and code instrumentation is already rather advanced programming to begin with.