/** * Constructs a new Brave instance that sends traces to the provided tracer. * * @param state for in-process propagation. Note {@link CommonSpanState#endpoint()} is ignored. */ public static Brave newBrave(Tracing tracing, ServerClientAndLocalSpanState state) { if (tracing == null) throw new NullPointerException("tracer == null"); if (state == null) throw new NullPointerException("state == null"); Clock delegate = brave.internal.Platform.get().clock(); return new Brave.Builder(state) .clock(new AnnotationSubmitter.Clock() { @Override public long currentTimeMicroseconds() { return delegate.currentTimeMicroseconds(); } @Override public String toString() { return delegate.toString(); } }) .spanFactory(new Brave4SpanFactory(tracing)) .recorder(new Brave4Recorder(tracing)).build(); }