Tracer { public Span newChild(TraceContext parent) { if (parent == null) throw new NullPointerException("parent == null"); return _toSpan(parent, decorateContext(parent, parent.spanId())); } Tracer(
    Clock clock,
    Propagation.Factory propagationFactory,
    SpanHandler spanHandler,
    PendingSpans pendingSpans,
    Sampler sampler,
    CurrentTraceContext currentTraceContext,
    boolean traceId128Bit,
    boolean supportsJoin,
    boolean alwaysSampleLocal,
    AtomicBoolean noop
  ); @Deprecated Tracer withSampler(Sampler sampler); Span newTrace(); final Span joinSpan(TraceContext context); Span newChild(TraceContext parent); Span nextSpan(TraceContextOrSamplingFlags extracted); Span toSpan(TraceContext context); SpanInScope withSpanInScope(@Nullable Span span); SpanCustomizer currentSpanCustomizer(); @Nullable Span currentSpan(); Span nextSpan(); ScopedSpan startScopedSpan(String name); ScopedSpan startScopedSpan(String name, SamplerFunction<T> samplerFunction, T arg); Span nextSpan(SamplerFunction<T> samplerFunction, T arg); Span nextSpanWithParent(SamplerFunction<T> samplerFunction, T arg,
    @Nullable TraceContext parent); ScopedSpan startScopedSpanWithParent(String name, @Nullable TraceContext parent); @Override String toString();  }
@Test public void newChild() { TraceContext parent = tracer.newTrace().context(); assertThat(tracer.newChild(parent)) .satisfies(c -> { assertThat(c.context().traceIdString()).isEqualTo(parent.traceIdString()); assertThat(c.context().parentIdString()).isEqualTo(parent.spanIdString()); }) .isInstanceOf(RealSpan.class); }
@Test public void newChild_resultantSpanIsLocalRoot() { Span span = tracer.newChild(context); assertThat(span.context().spanId()).isEqualTo(span.context().localRootId()); assertThat(span.context().isLocalRoot()).isTrue(); Span child = tracer.newChild(span.context()); assertThat(child.context().localRootId()).isEqualTo(span.context().localRootId()); assertThat(child.context().isLocalRoot()).isFalse(); }