Skip to content

Brave v4

Compare
Choose a tag to compare
@codefromthecrypt codefromthecrypt released this 05 Jan 15:36
· 1201 commits to master since this release

Brave 4 is a rewrite of the core tracing apis, designed to live alongside existing code. All you need to do is use TracerAdapter to create a (Brave 3) .. Brave. You don't have to change anything else.

Tracer brave4 = Tracer.newBuilder()...build();
Brave brave3 = TracerAdapter.newBrave(brave4);
// use what you already use today

Brave 4's api is made for today's problems, including arbitrarily nested, potentially asynchronous tasks. The new Span type is used for all types of operations: client, server, one-way, local.

Here's an example of modeling a nested task:

try (Span root = tracer.newTrace().name("2pc").start()) {
  try (Span child = tracer.newChild(root.context()).name("prepare").start()) {
    prepare();
  }
  try (Span child = tracer.newChild(root.context()).name("commit").start()) {
    commit();
  }
}

For more, take a look at the comprehensive README or learning tests for new features. Future versions of Brave will improve in-process propagation and start porting instrumentation appropriately.

Thanks to the reviewers @robinst @jplock @devinsba and @raphw, as well the prior art that inspired the new design.