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
Add brave module which supersedes zipkin module #1840
Conversation
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
Outdated
Show resolved
Hide resolved
abf601c
to
f75b932
Compare
Codecov Report
@@ Coverage Diff @@
## master #1840 +/- ##
============================================
+ Coverage 73.07% 73.12% +0.04%
- Complexity 8838 8880 +42
============================================
Files 784 788 +4
Lines 34698 34876 +178
Branches 4239 4262 +23
============================================
+ Hits 25356 25503 +147
- Misses 7186 7213 +27
- Partials 2156 2160 +4
Continue to review full report at Codecov.
|
f75b932
to
9619add
Compare
9619add
to
aea8255
Compare
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/common/tracing/AbstractTracingBuilder.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/common/tracing/AbstractTracingBuilder.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/server/tracing/TracingService.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/server/tracing/TracingService.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
Outdated
Show resolved
Hide resolved
52f8559
to
dce924f
Compare
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.
Nice work! 🚀
zipkin/src/main/java/com/linecorp/armeria/common/tracing/AbstractTracingBuilder.java
Outdated
Show resolved
Hide resolved
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.
My initial scan of this made me think its fine and I delayed taking a look but I'm having second thoughts now, sorry :(
I think it's very rare for an application to have multiple Tracing
instances - if they are all not configured exactly the same, there will be problems. As there will almost always be at least a server and a client, I think we're encouraging code duplication by having methods that don't accept Tracing
as both decorators will have to have the same method calls, and as Tracing
has some state like pending spans, it'll probably be less efficient to have them split up too. If this was an advanced case it's not so bad but it's the common case so I don't know how good it is to have these builders.
@adriancole Is it sane in the first place to have multiple Tracing
instances in an app?
core/src/main/java/com/linecorp/armeria/common/DefaultAggregatedHttpRequest.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
Show resolved
Hide resolved
@anuraaga I agree with you on that. Probably it's better not to have these builders because there's no way to share the same |
So let me remove the builders and leave the bug fix and renaming things 😉 Thanks! |
I agree: multiple tracing instances is usually a problem and we wouldnt
want to guide folks towards this as it unleashes all sorts of questions
such as whose threadlocal is this anyway? :)
…On Tue, Jun 18, 2019, 12:13 PM Anuraag Agrawal ***@***.***> wrote:
***@***.**** commented on this pull request.
My initial scan of this made me think its fine and I delayed taking a look
but I'm having second thoughts now, sorry :(
I think it's very rare for an application to have multiple Tracing
instances - if they are all not configured exactly the same, there will be
problems. As there will almost always be at least a server and a client, I
think we're encouraging code duplication by having methods that don't
accept Tracing as both decorators will have to have the same method
calls, and as Tracing has some state like pending spans, it'll probably
be less efficient to have them split up too. If this was an advanced case
it's not so bad but it's the common case so I don't know how good it is to
have these builders.
@adriancole <https://github.com/adriancole> Is it sane in the first place
to have multiple Tracing instances in an app?
------------------------------
In
core/src/main/java/com/linecorp/armeria/common/DefaultAggregatedHttpRequest.java
<#1840 (comment)>:
> +
+ @OverRide
+ public int hashCode() {
+ int result = headers().hashCode();
+ result = 31 * result + content().hashCode();
+ result = 31 * result + trailers().hashCode();
+ return result;
+ }
+
+ @OverRide
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof DefaultAggregatedHttpRequest)) {
Should equality compare against HttpRequest instead of the
implementation? What if there's another implementation that should compare
equal?
------------------------------
In
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
<#1840 (comment)>:
> */
-public class HttpTracingClient extends SimpleDecoratingClient<HttpRequest, HttpResponse> {
***@***.***
+public final class HttpTracingClient extends SimpleDecoratingClient<HttpRequest, HttpResponse> {
What do you think about extending TracingClient until this class is
removed?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1840?email_source=notifications&email_token=AAAPVVZTF6KVXIQ7SGFJLBLP3BOFRA5CNFSM4HYD3LPKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB3Z2I7A#pullrequestreview-250848380>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPVV3XJCYFH5YN73TCEHTP3BOFRANCNFSM4HYD3LPA>
.
|
bd72fad
to
7fd864a
Compare
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.
Good! 👍
@minwoox but |
/** | ||
* Creates a new tracing {@link Client} decorator using the specified {@link Tracing} instance. | ||
*/ | ||
public static Function<Client<HttpRequest, HttpResponse>, TracingClient> newDecorator(Tracing tracing) { |
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.
note we still have an issue to accept HttpTracing
.. even if we aren't implementing anything with that, it might make sense to use this as an arg to the decorator (internally calling httpTracing.tracing()) rather than go back and overload/deprecate later
* and the remote service name. | ||
*/ | ||
public static Function<Client<HttpRequest, HttpResponse>, TracingClient> newDecorator( | ||
Tracing tracing, @Nullable String remoteServiceName) { |
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.
if this had HttpTracing, the removeServiceName arg would be redundant and unnecessary as that's a part of HttpTracing
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.
made a note for consideration of future-proofing things. since this is api break anyway we can take advantage of this to move to HttpTracing as the graph supplied to the factory (instead of the Tracing graph).
This will give us most flexibility later
How about moving to |
brave/src/main/java/com/linecorp/armeria/client/brave/BraveClient.java
Outdated
Show resolved
Hide resolved
brave/src/main/java/com/linecorp/armeria/client/brave/BraveClient.java
Outdated
Show resolved
Hide resolved
brave/src/main/java/com/linecorp/armeria/common/brave/RequestContextCurrentTraceContext.java
Outdated
Show resolved
Hide resolved
brave/src/main/java/com/linecorp/armeria/common/brave/RequestContextCurrentTraceContext.java
Outdated
Show resolved
Hide resolved
brave/src/main/java/com/linecorp/armeria/server/brave/BraveService.java
Outdated
Show resolved
Hide resolved
brave/src/main/java/com/linecorp/armeria/client/brave/BraveClient.java
Outdated
Show resolved
Hide resolved
Motivation: A user currently has to build `Tracing` by him/herself and set `currentTraceContext` manually. We could add `HttpTracing(Client|Service)Builder` which builds a `Tracing` for a user. Modifications: - Add `HttpTracing(Client|Service)`Builder - May fix a bug where `decorateScope` is not called - Deprecation - The consturctor of `HttpTracingService` is not public anymore. A user should use the builder or the static factory method. Result: - A user can easidy build an `HttpTracing(Client|Service)` using builders.
5dea9f2
to
74f4c3e
Compare
74f4c3e
to
f9ee5d1
Compare
@anuraaga Fixed. PTAL 🙇 |
zipkin/src/main/java/com/linecorp/armeria/common/tracing/RequestContextCurrentTraceContext.java
Outdated
Show resolved
Hide resolved
zipkin/src/main/java/com/linecorp/armeria/client/tracing/HttpTracingClient.java
Outdated
Show resolved
Hide resolved
@trustin All fixed. PTAL 🙇 |
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.
Thanks! @minwoox 👍
578dee9
to
d56241e
Compare
d56241e
to
4c98058
Compare
Thanks for reviewing. 😉 |
Motivation: As @anuraaga comments, it's not Zipkin, but Brave we're interfacing. Modifications: - Move `internal.tracing` package in `zipkin` module to `internal.brave` in `brave` module. - Deprecation - `armeria-brave` supersedes `armeria-zipkin`. - `BraveClient` and `BraveService` supersedes `TracingHttpClient` and `TracingHttpService` - `RequestContextCurrentTraceContext` in `brave` supersedes the same class in `zipkin` - Fix a bug where `decorateScope` is not called. - Miscellaneous - Add missing `equals` in `DefaultAggregatedHttpRequest` - Update Brave from 5.6.5 -> 5.6.6 Result: - `armeria-brave` supersedes `armeria-zipkin`. - A user can now decorate a scope when it's created. - Close line#1792 anyway. - Brave 5.6.5 -> 5.6.6
Motivation:
As @anuraaga comments, it's not Zipkin, but Brave we're interfacing.
Modifications:
internal.tracing
package inzipkin
module tointernal.brave
inbrave
module.armeria-brave
supersedesarmeria-zipkin
.BraveClient
andBraveService
supersedesTracingHttpClient
andTracingHttpService
RequestContextCurrentTraceContext
inbrave
supersedes the same class inzipkin
decorateScope
is not called.equals
inDefaultAggregatedHttpRequest
Result:
armeria-brave
supersedesarmeria-zipkin
.