Skip to content
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

Merged
merged 5 commits into from Jul 2, 2019

Conversation

minwoox
Copy link
Member

@minwoox minwoox commented Jun 14, 2019

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:

@minwoox minwoox requested a review from anuraaga June 14, 2019 03:44
@minwoox minwoox added this to the 0.88.0 milestone Jun 14, 2019
@codecov
Copy link

codecov bot commented Jun 14, 2019

Codecov Report

Merging #1840 into master will increase coverage by 0.04%.
The diff coverage is 77.25%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
.../armeria/internal/brave/AsciiStringKeyFactory.java 100% <ø> (ø) 2 <0> (?)
.../com/linecorp/armeria/internal/brave/SpanTags.java 80.43% <ø> (ø) 9 <0> (?)
...orp/armeria/common/sse/DefaultServerSentEvent.java 41.93% <0%> (ø) 7 <0> (ø) ⬇️
...p/armeria/common/DefaultAggregatedHttpRequest.java 30.76% <0%> (-69.24%) 6 <0> (ø)
...com/linecorp/armeria/common/DefaultRpcRequest.java 73.17% <0%> (ø) 13 <0> (ø) ⬇️
...corp/armeria/client/tracing/HttpTracingClient.java 92.15% <100%> (+0.32%) 13 <2> (ø) ⬇️
...orp/armeria/server/tracing/HttpTracingService.java 100% <100%> (ø) 10 <0> (ø) ⬇️
...necorp/armeria/internal/brave/SpanContextUtil.java 100% <100%> (ø) 3 <1> (?)
...ecorp/armeria/internal/brave/TraceContextUtil.java 100% <100%> (ø) 3 <3> (?)
...om/linecorp/armeria/server/brave/BraveService.java 100% <100%> (ø) 10 <10> (?)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 294e987...4c98058. Read the comment docs.

@minwoox minwoox changed the title Add HttpTracing(Client|Service)Builder Add HttpTracingClientBuilder and TracingServiceBuilder Jun 14, 2019
@minwoox minwoox changed the title Add HttpTracingClientBuilder and TracingServiceBuilder Add TracingClientBuilder and TracingServiceBuilder Jun 17, 2019
Copy link
Member

@trustin trustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🚀

Copy link
Collaborator

@anuraaga anuraaga left a 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?

@minwoox
Copy link
Member Author

minwoox commented Jun 18, 2019

@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 Tracing.

@minwoox
Copy link
Member Author

minwoox commented Jun 18, 2019

So let me remove the builders and leave the bug fix and renaming things 😉 Thanks!

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jun 18, 2019 via email

@minwoox minwoox force-pushed the add_tracing_builder branch 2 times, most recently from bd72fad to 7fd864a Compare June 18, 2019 10:09
@minwoox minwoox changed the title Add TracingClientBuilder and TracingServiceBuilder Fix a bug where ScopeDecorator.decorateScope is not invoked Jun 18, 2019
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! 👍

@ikhoon
Copy link
Contributor

ikhoon commented Jun 19, 2019

@minwoox but codecov/patch shows the coverage of diff(63.2%) is lower than the target one.

/**
* Creates a new tracing {@link Client} decorator using the specified {@link Tracing} instance.
*/
public static Function<Client<HttpRequest, HttpResponse>, TracingClient> newDecorator(Tracing tracing) {
Copy link
Contributor

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) {
Copy link
Contributor

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

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a 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

@trustin
Copy link
Member

trustin commented Jun 24, 2019

How about moving to tracing.zipkin (or just to zipkin) and renaming to ZipkinClient/Service by taking advantage of this breaking change, then? We may need to add tracing.opentracing or other vendor-specific implementations later.

@minwoox minwoox changed the title Fix a bug where ScopeDecorator.decorateScope is not invoked Add brave module which supersedes zipkin module Jun 28, 2019
@minwoox
Copy link
Member Author

minwoox commented Jun 28, 2019

@minwoox but codecov/patch shows the coverage of diff(63.2%) is lower than the target one.

@ikhoon Increased the coverage. 😉

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.
@minwoox minwoox force-pushed the add_tracing_builder branch 3 times, most recently from 5dea9f2 to 74f4c3e Compare July 1, 2019 09:13
@minwoox
Copy link
Member Author

minwoox commented Jul 1, 2019

@anuraaga Fixed. PTAL 🙇

@minwoox
Copy link
Member Author

minwoox commented Jul 1, 2019

@trustin All fixed. PTAL 🙇

Copy link
Member

@trustin trustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @minwoox 👍

@trustin trustin merged commit fd8b57e into line:master Jul 2, 2019
@minwoox minwoox deleted the add_tracing_builder branch July 2, 2019 06:53
@minwoox
Copy link
Member Author

minwoox commented Jul 2, 2019

Thanks for reviewing. 😉

fmguerreiro pushed a commit to fmguerreiro/armeria that referenced this pull request Sep 19, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HttpTracingClient/ServiceBuilder
5 participants