-
Notifications
You must be signed in to change notification settings - Fork 1
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
Initial implementation of ContinuationLocal #1
base: master
Are you sure you want to change the base?
Conversation
The implementation is a direct port of com.twitter.util.Local: https://github.com/twitter/util/blob/fe29be6ce62d27611ddfe94fdc9e9ec294375330/util-core/src/main/scala/com/twitter/util/Local.scala https://github.com/twitter/util/blob/fe29be6ce62d27611ddfe94fdc9e9ec294375330/util-core/src/test/scala/com/twitter/util/LocalTest.scala An ExecutorService wrapper is also provided, meant to wrap thread pools so that the ContinuationLocal state is passed on. This implementation is inspired by BraveExecutorService and FuturePool: https://github.com/kristofa/brave/blob/df55efd5653bccdb4736fd63413f10772a5bb5e2/brave-core/src/main/java/com/github/kristofa/brave/BraveExecutorService.java https://github.com/twitter/util/blob/fe29be6ce62d27611ddfe94fdc9e9ec294375330/util-core/src/main/scala/com/twitter/util/FuturePool.scala
@daniel-bryant-uk looking at your not so recent blog, you might be interested in this. |
## Usage example | ||
|
||
```java | ||
import com.github.distributivetracing.ContinuationLocal |
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.
typo
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.
Oops. Referring to the missing semicolon?
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.
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.
ok, fixed!
TL;DR; Disclaimer: this is just an opinion of a passer-by.. don't anchor too much on it. I'm just voicing my 2p. I'm glad to see a proposal to a part of the Shared JVM Implementation problem. My opinion, but I'd define success in this org as folks actually sharing a context vs being like Those who might use a java context propagation api, in terms of dapper, include HTrace (@saintstack), Brave (@kristofa), Pinpoint (@Xylus), Lyft (@jpinner), Spring Cloud (@dsyer @spencergibb) and Netflix (@NiteshKant). There's also work brewing in GRPC which will eventually support dapper itself. |
Yes, it's a port of |
It looks like most other implementations are familiar with |
- Fix spelling mistake; "distributive" should be "distributed" - Add link to the code for com.twitter.util.Local
This ensures that our code is compatible with Java 6 or newer.
Pretty much. I think that the 'inspired by' story is more a sideline than a headline. Credit inspiration, but at the same time I suspect this will deviate and These suggestions follow normal disclaimer of 'toss if unneeded' ;) |
@@ -0,0 +1,170 @@ | |||
package com.github.distributedtracing; |
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.
Is this ultimately what we want? Might as well state your intent and go for
org.continuation
from the start
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.
+1 to not having it in the com.github namespace.
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.
I do +1 it myself.
org.continuation is a good namespace, since it's not directly tied to distributed tracing. One could use a ContinuationLocal for other things as well, like passing around business logic state, even though I would certainly not recommend that.
I'm curious what the next steps are here to get this merging, or if this is effectively at dead PR. I'm mostly interested in this in the context of openzipkin/brave#166 so if there is anything I can do to help push this, please let me know. Thanks! |
Jakub was looking at this, but offline. If you are in a position to tackle On 10 Aug 2016 20:03, "David Schlosnagle" [email protected] wrote:
|
Thanks Adrian. I actually work with Jakub, and have some time this week as part of a hack week project instrumenting a variety of systems with Zipkin & Brave, so I'll create a Brave PR to iterate.
|
You're free to pick it up from here! |
Keep us posted on gitter! Ps once things are sorted, local to brave, we can On 10 Aug 2016 9:13 pm, "David Schlosnagle" [email protected]
|
some interesting development out of this is a recent addition to log4j 2.7 which incidentally came out of a feature request to pull in state from finagle locals. https://issues.apache.org/jira/browse/LOG4J2-1010 I'd say ContextDataInjector is an example of something we could attempt to implement in a usage test case, to see if we can share a context across diversely written apps. |
ps thanks for this.. I've grabbed the parts needed for brave. we can revisit this in the new design as context is pluggable now |
Here's a (more or less) direct port of com.twitter.util.Local to Java, with only a few differences.
This ContinuationLocal needs mainstream adoption in order to work (every library that's dealing with threads and/or events needs to support it), so we have to get it right.
Any comments from the Twitter guys who wrote this (in Scala) in the first place?
@adriancole @mosesn @mariusae @evnm ?