-
Notifications
You must be signed in to change notification settings - Fork 12
Adds java-concurrent #41
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
Adds java-concurrent #41
Conversation
|
@jam01 Thanks for the PR - however the rules are trying to do the same work that has been done in the java-concurrent lib. The aim of the rules is just to install the framework instrumentation libs. For example, the rules should be of the form: |
|
Hey @objectiser I originally was going to go that route. However the problem with that approach is that that'd only instrument executors that are instantiated through those factory methods. Any concrete implementation instantiated directly would not be instrumented. The framework I'm trying to instrument does not make use of |
|
@jam01 You are right - the executors can be initialised in different ways - however the approach you have taken with the rules requires the executors to be cached, which is a memory leak. I've experimented with the following rules (replace contents in your otarules.btm file) that does not require the additional helper. They pass all of the existing tests - can you see if they work in your environment? If not, could you add tests that replicate any problem you are seeing with the framework you are trying to instrument. |
|
Hey @objectiser these rules would definitely work out, but at this point I think we're definitely replicating the TracedExecutors' logic. If their logic changed we'd have to change the rules. For example I was working through another PR where the TracedExec would check if the ScopeManager is AutoFinish or not, because if so then we might want to to use a Continuation instead. That might not end up being valid behaviour but I think the argument is valid. About the caching helper, this was more of an optimization than a necessity, if we can't make it work then we could do w/o it and just create a new TracedExec for every method call. If I understand the spring-cloud-contrib interceptor that's exactly what it's doing, new method invoke = new TracedExec just for that call. But I was actually thinking about the cache before your point on memory leak and maybe something like this might help, plus maybe make all getter methods synchronized? |
|
Oh! The example I provided about I also take it that since you removed the calls for |
|
I think it is less likely that changes would occur in the
Based on the tests you have defined, this seems to be the case. |
objectiser
left a comment
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.
Just a few minor things to fix.
One general point - if you could avoid squashing commits until the review process is completed, it makes it easier to review - we then only need to look at what has changed between each review cycle.
pom.xml
Outdated
| <version.io.opentracing.contrib.tracerresolver>0.1.5</version.io.opentracing.contrib.tracerresolver> | ||
| <version.io.opentracing.contrib.web-servlet-filter>0.1.1</version.io.opentracing.contrib.web-servlet-filter> | ||
| <version.io.opentracing.contrib.okhttp3>0.1.0</version.io.opentracing.contrib.okhttp3> | ||
| <version.io.opentracing.contrib.concurrent>0.2.1-SNAPSHOT</version.io.opentracing.contrib.concurrent> |
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.
You need to change this to 0.2.0.
...a-concurrent/src/test/java/io/opentracing/contrib/agent/concurrent/ExecutorServiceITest.java
Outdated
Show resolved
Hide resolved
...ent/src/test/java/io/opentracing/contrib/agent/concurrent/ScheduledExecutorServiceITest.java
Outdated
Show resolved
Hide resolved
|
Thanks @jam01 |
Adds byteman rules for intercepting calls to java.util.concurrent.Executor interface and subinterfaces and proxying to appropriate TracedExecutors.
Is dependent on opentracing-contrib/java-concurrent#11