armeria-0.11.0.Final
trustin
released this
04 Mar 06:09
·
4249 commits
to main
since this release
New features
- #114 Distributed tracing via Zipkin/Brave
This release introduces distributed tracing capability to Armeria clients and servers using Brave, a distributed tracing library compatible with Zipkin. This enables us to watch timing data among the whole Armeria RPC chain.
Decorating a client
// Create a brave instance with service name, span collector, and sampling rate.
Brave brave = new Brave.Builder("MyClientMain")
.spanCollector(new ScribeSpanCollector("127.0.0.1", 9410))
.traceSampler(Sampler.create(0.01f))
.build();
MyService.Iface client =
new ClientBuilder("tbinary+http://127.0.0.1:8080/thrift/myService")
.decorator(HttpTracingClient.newDecorator(brave))
.build(MyService.Iface.class);
Decorating a server
// Create a brave instance with service name, span collector, and sampling rate.
Brave brave = new Brave.Builder("MyServiceMain")
.spanCollector(new ScribeSpanCollector("127.0.0.1", 9410))
.traceSampler(Sampler.create(0.01f))
.build();
ServerBuilder builder = new ServerBuilder();
builder.port(8080, SessionProtocol.HTTP);
builder.serviceAt("/thrift/myservice",
ThriftService.of(new MyServiceHandler(brave))
.decorate(HttpTracingService.newDecorator(brave));