-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 gRPC endpoint /zipkin.proto3.SpanService/Report #2328
Adds gRPC endpoint /zipkin.proto3.SpanService/Report #2328
Conversation
zipkin-server-grpc/src/main/java/zipkin2/server/grpc/ZipkinGrpcServer.java
Outdated
Show resolved
Hide resolved
If you use armeria :) Upstream gRPC doesn't support it yet I think, or even if it did it would only be HTTP/2, not HTTP/1. |
If you use armeria :) Upstream gRPC doesn't support it yet I think, or
even if it did it would only be HTTP/2, not HTTP/1.
frankly I think we should switch to armeria then. we have several
contributors who are also contributors to armeria. zipkin always tries to
be simplest possible setup and adding ports betrays this. if we are talking
about grpc being shaded anyway we can just make stackdriver use the shaded
one (or potentially convert its storage module also to armeria)
… |
I guess the talking points would be that armeria still isn't GA and has more dependencies. But agree that more ports is annoying and a big reason I love armeria :) |
we dont promise any api compat for our server, so not worries. if we did
armeria we would just add grpc endpoint directly to the zipkin-server imho
and not mess with extra modules.
…On Sun, Dec 16, 2018, 11:52 AM Anuraag Agrawal ***@***.*** wrote:
I guess the talking points would be that armeria still isn't GA and has
more dependencies. But agree that more ports is annoying and a big reason I
love armeria :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD615g9RvQRBh3NmUZu5W5YK1v4W-b8ks5u5cORgaJpZM4ZU_jb>
.
|
also good point on the deps of armeria. similar audit would apply to ensure
things still work ;)
FWIW current Cassandra driver supports a range of guava starting at 16
iirc. later it doesnt depend on guava. almost everything else has no
conflicts due to okhttp directly. we would need to watch that zipkin-aws
and zipkin-gcp extensions dont conflict.
…On Sun, Dec 16, 2018, 11:59 AM Adrian Cole ***@***.*** wrote:
we dont promise any api compat for our server, so not worries. if we did
armeria we would just add grpc endpoint directly to the zipkin-server imho
and not mess with extra modules.
On Sun, Dec 16, 2018, 11:52 AM Anuraag Agrawal ***@***.***
wrote:
> I guess the talking points would be that armeria still isn't GA and has
> more dependencies. But agree that more ports is annoying and a big reason I
> love armeria :)
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#2328 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAD615g9RvQRBh3NmUZu5W5YK1v4W-b8ks5u5cORgaJpZM4ZU_jb>
> .
>
|
I can look into armeria as an alternative. The biggest trick here is going to be in the serializer though. We have to use Zipkin’s Proto3Codec instead of relying on the server implementation to deserialize the span payload. I’m not sue if any of the server implementations support the concept of lazy deserialization. If they don’t, then I’ll have to plug into the serialization pipeline. |
For the zero copy aspect, it might be simplest to define the client API in zipkin-api as is but use an internal proto here that replaces Span with bytes. Embedded messages and strings are encoded exactly the same in proto. https://developers.google.com/protocol-buffers/docs/encoding |
Also I guess you would want to use the new support for plugging in as a spring webflux server - I don't know what that means since I haven't used spring recently but probably relevant. And if you use this unsafe option you'd be able to have real zero-copy with no heap arrays involved until the zipkin2.Span |
There are a few more dependencies with [INFO] +- com.linecorp.armeria:armeria-grpc-shaded:jar:0.75.0:compile
[INFO] | +- com.linecorp.armeria:armeria-shaded:jar:0.75.0:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile
[INFO] | | +- io.micrometer:micrometer-core:jar:1.1.0:compile
[INFO] | | | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | | | \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
[INFO] | | +- io.netty:netty-codec-haproxy:jar:4.1.31.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.31.Final:compile
[INFO] | | +- io.netty:netty-codec-http2:jar:4.1.31.Final:compile
[INFO] | | | +- io.netty:netty-codec-http:jar:4.1.31.Final:compile
[INFO] | | | \- io.netty:netty-handler:jar:4.1.31.Final:compile
[INFO] | | +- io.netty:netty-resolver-dns:jar:4.1.31.Final:compile
[INFO] | | | +- io.netty:netty-resolver:jar:4.1.31.Final:compile
[INFO] | | | \- io.netty:netty-codec-dns:jar:4.1.31.Final:compile
[INFO] | | +- io.netty:netty-tcnative-boringssl-static:jar:2.0.19.Final:compile
[INFO] | | +- io.netty:netty-transport:jar:4.1.31.Final:compile
[INFO] | | | \- io.netty:netty-buffer:jar:4.1.31.Final:compile
[INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.31.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.31.Final:compile
[INFO] | | | \- io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile
[INFO] | | +- io.netty:netty-transport-native-unix-common:jar:linux-x86_64:4.1.31.Final:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.2:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- org.curioswitch.curiostack:protobuf-jackson:jar:0.3.0:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.1:runtime
[INFO] | | +- com.google.protobuf:protobuf-java-util:jar:3.6.1:runtime Neither On the plus side, I believe you can run HTTP/1, gRPC, and gRPC-Web all from the same server instance. GRPC-Web only supports unary RPC at present, so would need to provide a unary method for sending spans as well (or alternatively drop streaming support). |
@anuraaga - For implementing the |
to see differences more directly probably add it as a dep on zipkin-server
then build the exec jar. do a jar -tvf|sort before and after and diff
those. I suspect Jackson is already in the main exec jar even if we don't
use it (I think zipkin-aws does)
…On Sun, Dec 16, 2018, 2:49 PM Eric Hauser ***@***.*** wrote:
There are a few more dependencies with armeria:
[INFO] +- com.linecorp.armeria:armeria-grpc-shaded:jar:0.75.0:compile[INFO] | +- com.linecorp.armeria:armeria-shaded:jar:0.75.0:compile[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.7:compile[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile[INFO] | | +- io.micrometer:micrometer-core:jar:1.1.0:compile[INFO] | | | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile[INFO] | | | \- org.latencyutils:LatencyUtils:jar:2.0.3:compile[INFO] | | +- io.netty:netty-codec-haproxy:jar:4.1.31.Final:compile[INFO] | | | \- io.netty:netty-codec:jar:4.1.31.Final:compile[INFO] | | +- io.netty:netty-codec-http2:jar:4.1.31.Final:compile[INFO] | | | +- io.netty:netty-codec-http:jar:4.1.31.Final:compile[INFO] | | | \- io.netty:netty-handler:jar:4.1.31.Final:compile[INFO] | | +- io.netty:netty-resolver-dns:jar:4.1.31.Final:compile[INFO] | | | +- io.netty:netty-resolver:jar:4.1.31.Final:compile[INFO] | | | \- io.netty:netty-codec-dns:jar:4.1.31.Final:compile[INFO] | | +- io.netty:netty-tcnative-boringssl-static:jar:2.0.19.Final:compile[INFO] | | +- io.netty:netty-transport:jar:4.1.31.Final:compile[INFO] | | | \- io.netty:netty-buffer:jar:4.1.31.Final:compile[INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.31.Final:compile[INFO] | | | +- io.netty:netty-common:jar:4.1.31.Final:compile[INFO] | | | \- io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile[INFO] | | +- io.netty:netty-transport-native-unix-common:jar:linux-x86_64:4.1.31.Final:compile[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.2:compile[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile[INFO] | +- org.curioswitch.curiostack:protobuf-jackson:jar:0.3.0:compile[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.1:runtime[INFO] | | +- com.google.protobuf:protobuf-java-util:jar:3.6.1:runtime
Neither netty or jackson being shaded is less than ideal. Appears that
armeria is choosing not to shade netty in the future - line/armeria#705
<line/armeria#705>.
On the plus side, I believe you can run HTTP/1, gRPC, and gRPC-Web all
from the same server instance. GRPC-Web only supports unary RPC at present,
so would need to provide a unary method for sending spans as well (or
alternatively drop streaming support).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD619eocVJfmM50scArKKnoLrx0600Zks5u5ez9gaJpZM4ZU_jb>
.
|
I was thinking this would be simplest by having Public API proto, used by clients
while the server actually implements a different, non-exposed proto
The protos are compatible so the clients get the advantage of the generated code and easy-to-populate structs while the server would only see the It has the downside of duplicate protos but it's probably a lot less complex than a custom |
Got it. Yes, that is a definitely easier and a nice trick. Will give it a shot. Thanks! |
So, @anuraaga's trick doesn't work - at least with gRPC Java. The issue is that the marshaller will have already copied the input stream into a So I took the approach of implementing a custom [INFO] +- io.grpc:grpc-netty-shaded:jar:1.17.1:runtime
[INFO] | \- io.grpc:grpc-core:jar:1.17.1:compile (version selected from constraint [1.17.1,1.17.1])
[INFO] | +- io.grpc:grpc-context:jar:1.17.1:compile
[INFO] | +- com.google.code.gson:gson:jar:2.7:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.2.0:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] | +- com.google.guava:guava:jar:26.0-android:compile
[INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.5.2:compile
[INFO] | | \- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | +- io.opencensus:opencensus-api:jar:0.17.0:compile
[INFO] | \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.17.0:compile
[INFO] +- io.grpc:grpc-stub:jar:1.17.1:compile So this ends up being much less of a dependency burden than However, |
b2a24b0
to
089cb22
Compare
yes armeria would imply geting rid of undertow and its deps. undertow was
only added for better perf.
plan sounds fine, but I'm really not keen merging another port to expose.
meaning if helpful for development can separate, but please don't release
us needing to support a second http port perpetually unless the change to
undo that immediately follows.
…On Mon, Dec 17, 2018 at 6:28 AM Eric Hauser ***@***.***> wrote:
So, @anuraaga <https://github.com/anuraaga>'s trick doesn't work - at
least with gRPC Java. The issue is that the marshaller will have already
copied the input stream into a ByteString prior to getting access to it.
So I took the approach of implementing a custom BindableService. This has
the added benefit of removing all dependencies on Protocol Buffers
entirely. Here are the dependencies introduced now:
[INFO] +- io.grpc:grpc-netty-shaded:jar:1.17.1:runtime
[INFO] | \- io.grpc:grpc-core:jar:1.17.1:compile (version selected from constraint [1.17.1,1.17.1])
[INFO] | +- io.grpc:grpc-context:jar:1.17.1:compile
[INFO] | +- com.google.code.gson:gson:jar:2.7:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.2.0:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] | +- com.google.guava:guava:jar:26.0-android:compile
[INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.5.2:compile
[INFO] | | \- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | +- io.opencensus:opencensus-api:jar:0.17.0:compile
[INFO] | \- io.opencensus:opencensus-contrib-grpc-metrics:jar:0.17.0:compile
[INFO] +- io.grpc:grpc-stub:jar:1.17.1:compile
So this ends up being much less of a dependency burden than armeria - no
netty, protobufs -- with the downside of having the collector run on a
different port. We can keep this version of gRPC in sync with the version
that is being used by zipkin-gcp to avoid any issues.
However, armeria does have the advantage of everything being on the same
port and it would support gRPC-Web out of the box without a proxy. Would
switching to armeria mean that it would eliminate undertow and just use
it for everything? If so, we shoud probably find a path to finalizing the
gRPC API in this PR and moving forward with this experimental version on a
different port. A separate issue could be opened for moving to armeria -
given the size of that change, I would want to make sure there was plenty
of support for it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD61xBtWXssSyhRFKTCIDIxNHiQjwLtks5u5skggaJpZM4ZU_jb>
.
|
PS it isn't fair to put the burden of switching all to armeria on Eric :P I
will spike a PR so in case this happens while I'm away (I'm out tomorrow)
the grunt work is ready.
|
I started this whole mess so I'm fine rolling up my sleeves on the switch. Just want to make sure there is support behind it. |
I started this whole mess so I'm fine rolling up my sleeves on the switch. Just want to make sure there is support behind it.
I think there's some sort of "jury's still out" in general.
The trick is that adding an optional module will likely become
effectively required as there is so much marketing buzz around gRPC.
So, we have to be quite careful how to introduce this. scribe being on
a different port caused a bunch of pain back in the day with people
invariably choosing the wrong port, having to go through work to
figure it out (matters not if docs say use the right port), then going
onto support and moving the concern there, or triple posted issues
etc.
Basically, if we're going to do this, in the case of gRPC, I think we
ought to consider this becoming effectively required, and how to stop
the most type of problems we can't control. We do have a lot of
control over the server and extensions of it as we explicitly give
zero warranty on custom builds. We have little control over config
mistakes even with docs.
|
ps I'll graciously accept your offer to do the armeria spike if comes
to that. I'll raise an issue on it.
|
here's the issue for armeria #2331 |
@ewhauser wrote:
The Armeria project maintainers including LINE employees like me (@hyangtack and @minwoox as well) would be happy to support Zipkin community for adoption of Armeria and its sustainable development. I believe you don't need to worry too much about the future of Armeria given that it's being used in various critical parts of LINE services. |
For the copying issue, just to clarify, using the proto approach makes
and then using Armeria's unsafe option can make it become
Of course it depends on the decision of moving to armeria, but if we do, I'd still recommend using the proto trick + unsafe option. |
Agreed. If armeria is the way forward, then this is the better option.
…On Sun, Dec 16, 2018 at 9:27 PM Anuraag Agrawal ***@***.***> wrote:
For the copying issue, just to clarify, using the proto approach makes
ByteBuf -> zipkin.proto3.Span -> byte[] -> zipkin2.Span become
ByteBuf -> byte[] -> zipkin2.Span
and then using Armeria's unsafe option can make it become
ByteBuf -> zipkin2.Span
Proto3Codec needs to be updated to accept ByteBuffer, which is pretty
simple change I think. On the flip side, I think it's not practical for it
to parse the InputStream directly since doing that efficiently would
probably require using the KnownLength class inside of Proto3Codec which
shouldn't have gRPC dependencies.
Of course it depends on the decision of moving to armeria, but if we do,
I'd still recommend using the proto trick + unsafe option.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIBPYlevMan0sbk2a4G6hQKSHDqLdb8ks5u5ys9gaJpZM4ZU_jb>
.
|
Trustin - armeria seems like a great project. More so wanted to make sure
there was support for using it within zipkin-server. There are a lot of
consumers that I don’t want to break; thank you for the offer to help
support with the adoption!
…On Sun, Dec 16, 2018 at 9:04 PM Trustin Lee ***@***.***> wrote:
@ewhauser <https://github.com/ewhauser> wrote:
I would want to make sure there was plenty of support for it.
The Armeria project maintainers including LINE employees like me (
@hyangtack <https://github.com/hyangtack> and @minwoox
<https://github.com/minwoox> as well) would be happy to support Zipkin
community for adoption of Armeria and its sustainable development. I
believe you don't need to worry too much about the future of Armeria given
that it's being used in various critical parts of LINE services.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2328 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIBPcM8jeHwTR8aNnQ7R5wclDKRwkanks5u5yXNgaJpZM4ZU_jb>
.
|
@ewhauser I think this is ready to merge. We aren't releasing right away as the project is in the middle of an ASF move. However, the remaining task of perf testing will be easier once merged as people can build off master. The feature is currently disabled under a flag. I don't expect perf testing to be surprising as this is not much different than vanilla armeria http, but yeah once we have a grpc sender we can hook it up and compare. |
The zero copy thing is in a different change, btw, it isn't grpc specific #2435 |
As long as this PR is up-to-date with master, maybe this is a good opportunity to try out Jitpack for testing pre-merge? |
f91d9a1
to
7a0c3ce
Compare
@shakuzen sure.. anyone want to translate this into eric's branch name? "https://jitpack.io/com/github/apache/incubator-zipkin/zipkin-server/2.12.9/zipkin-server-2.12.9-exec.jar" |
ps this is up to date with master which means the maven package is org.apache.zipkin (with much rejoicin) |
@@ -98,7 +98,10 @@ public void addViewControllers(ViewControllerRegistry registry) { | |||
// could split the collector's CORS policy into a different property, still allowing POST | |||
// with content-type by default. | |||
.allowRequestMethods(HttpMethod.GET, HttpMethod.POST) | |||
.allowRequestHeaders(HttpHeaderNames.CONTENT_TYPE); | |||
.allowRequestHeaders(HttpHeaderNames.CONTENT_TYPE, |
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.
@trustin fyi in armeria repo I mentioned something about different modules needing to collaborate on CORS config. since this is now baked into zipkin server directly now, there is minimal impact to us.
oops on rebase lost update to zipkin proto 0.2.0 |
7a0c3ce
to
a6b582b
Compare
@shakuzen I just now realize how extremely complex our test setup is vs just using wire (which doesn't require a shell out to protoc). I raised a small revision to our proto as I think now's the time openzipkin/zipkin-api#64 |
will rebase once the following are in:
|
a6b582b
to
94ac6cf
Compare
ok now using a JVM impl square/wire to compile the protos needed for the integration tests. maybe jitpack works now |
I broke the build settings for integration test (cli only, as intellij is fine).. will fix. here's the command to get to the same fail as travis
|
zipkin-server/README.md
Outdated
If you need to deploy a collector-only server, you can disable other http endpoints like so: | ||
|
||
```bash | ||
GRPC_COLLECTOR_ENABLED=true HTTP_COLLECTOR_ENABLED=false QUERY_ENABLED=false java -jar zipkin.jar |
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.
ps I'm just now noticing our env convention is backwards.
it might be ok to keep it, to be in parity with http. or we can add COLLECTOR_HTTP_ENABLED as a fallback instead of propagating the backwards convention to grpc
those who want to test other language reporters against this before release can do the following: $ curl -sSL https://jitpack.io/com/github/ewhauser/zipkin/zipkin-server/experimental-grpc-1.5.0-g94ac6cf-1164/zipkin-server-experimental-grpc-1.5.0-g94ac6cf-1164-exec.jar > zipkin.jar
$ GRPC_COLLECTOR_ENABLED=true java -jar zipkin.jar |
added a commit to unhook this from snapshots. will merge on green |
updated description |
This adds an opt-in gRPC endpoint for reporting spans. A request to the gRPC `/zipkin.proto3.SpanService/Report` service is the same proto used with our `POST /api/v2/spans`, `Content-Type: application/x-protobuf` endpoint: `zipkin.proto3.ListOfSpans`. This is currently disabled by default, as the feature is experimental. Enable it like so: ```bash $ COLLECTOR_GRPC_ENABLED=true java -jar zipkin.jar ``` Under the scenes the runtime is the same as the POST endpoint (Armeria), and uses the same port (9411).
93080a5
to
8b00db6
Compare
8b00db6
to
10b478a
Compare
This adds an opt-in gRPC endpoint for reporting spans. A request to the gRPC `/zipkin.proto3.SpanService/Report` service is the same proto used with our `POST /api/v2/spans`, `Content-Type: application/x-protobuf` endpoint: `zipkin.proto3.ListOfSpans`. This is currently disabled by default, as the feature is experimental. Enable it like so: ```bash $ COLLECTOR_GRPC_ENABLED=true java -jar zipkin.jar ``` Under the scenes the runtime is the same as the POST endpoint (Armeria), and uses the same port (9411).
This adds an opt-in gRPC endpoint for reporting spans. A request to the gRPC `/zipkin.proto3.SpanService/Report` service is the same proto used with our `POST /api/v2/spans`, `Content-Type: application/x-protobuf` endpoint: `zipkin.proto3.ListOfSpans`. This is currently disabled by default, as the feature is experimental. Enable it like so: ```bash $ COLLECTOR_GRPC_ENABLED=true java -jar zipkin.jar ``` Under the scenes the runtime is the same as the POST endpoint (Armeria), and uses the same port (9411).
This adds an opt-in gRPC endpoint for reporting spans. A request to the
gRPC
/zipkin.proto3.SpanService/Report
service is the same proto usedwith our
POST /api/v2/spans
,Content-Type: application/x-protobuf
endpoint:
zipkin.proto3.ListOfSpans
.This is currently disabled by default, as the feature is experimental.
Enable it like so:
Under the scenes the runtime is the same as the POST endpoint (Armeria),
and uses the same port (9411).
former description:
This PR is an offshoot of a discussion in openzipkin/zipkin-api#57 . There are a number of issues that need to be addressed before consideration of merge:
zipkin-api
Also, there is still some discussion about whether the project as a whole wants to support a gRPC endpoint in
zipkin-server
due to potential bloat. See the discussion in zipkin-api#57 for background.