Brave 4.8
Brave v4.8 supports customizable gRPC tracing, pluggable propagation (headers), and running without zipkin v1 types. You should also check out zipkin-php which is a PHP port of the Brave v4 apis.
Customizable gRPC tracing
Our gRPC tracing is tested against the version range 1.2-1.6. This is great for helping understanding requests while the framework evolves. With effort from @jorgheymans, this is better now. Before, you couldn't declare a span customization policy, like we have in http. Now.. you can.
For example, this will add a tag of the grpc message sent from a client to a server, and renames the span to something of lower cardinality:
grpcTracing = GrpcTracing.newBuilder(tracing)
.clientParser(new GrpcClientParser() {
@Override protected <M> void onMessageSent(M message, SpanCustomizer span) {
span.tag("grpc.message_sent", message.toString());
}
@Override protected <ReqT, RespT> String spanName(MethodDescriptor<ReqT, RespT> methodDescriptor) {
return methodDescriptor.getType().name();
}
})
.build();
For more info, check out the README
Note be careful with this, especially adding payloads as span tags. Spans are typically best < 1KiB for transport and storage efficiency.
Pluggable propagation
While the default has always been B3, there are efforts such as trace-context to define a standards-track format. To support this, we needed to do two things:
- Add Propagation.Factory.supportsJoin - to indicate if a format carries parent identification needed to share a span on both sides of an RPC (B3 does, but many others don't)
- Expose Tracing.Builder.propagationFactory - to allow you to replace the implementation with something like trace-context
- Create PropagationTest - to ensure implementations actually work.
A future version will have an experimental implementation of trace-context, and/or the pilot version already in use by gRPC via the OpenCensus project. Please keep an eye out for more on this.
Running without zipkin v1 types
In the past release, we added Tracing.Builder.spanReporter
for configuring zipkin v2. Now that Zipkin Reporter 2 is out, you can manually exclude the io.zipkin.java:zipkin
, eliminating a 300Kib dependency.
If you want to see how to do this, you can look at our example repository.
Zipkin PHP
Through significant effort by @jcchavezs, there's now a PHP port of brave v4 tracing, called
zipkin-php. Please give it a try and any feedback you might have. If you want a quick start, you can look at the example project.