@Test public void testMultipleThreads() throws InterruptedException { final SpanSink sink = mock(SpanSink.class); SpanSinkRegistry.register(sink); final CyclicBarrier inside = new CyclicBarrier(2); final Thread one = new Thread(new BarrierSpanRunner("threadOne", inside)); final Thread two = new Thread(new BarrierSpanRunner("threadTwo", inside)); one.start(); two.start(); one.join(); two.join(); final ArgumentCaptor<Span> captor = ArgumentCaptor.forClass(Span.class); verify(sink, times(2)).record(captor.capture()); final List<Span> spans = captor.getAllValues(); assertEquals(2, spans.size()); assertEquals(Optional.<BigInteger>absent(), spans.get(0).getParentSpanId()); assertEquals(Optional.<BigInteger>absent(), spans.get(1).getParentSpanId()); }
public final Optional<BigInteger> getParentSpanId() { return parentSpanId; }
Span implements AutoCloseable, SpanData { public final Optional<BigInteger> getParentSpanId() { return parentSpanId; } }
Span implements AutoCloseable, SpanData { public final Optional<BigInteger> getParentSpanId() { return parentSpanId; } protected  Span(Optional<BigInteger> parentSpanId, BigInteger spanId, String name, BigInteger traceId, long startTime, long startNanos, TraceLevel traceLevel); }
Span implements AutoCloseable, SpanData { public final Optional<BigInteger> getParentSpanId() { return parentSpanId; } protected  Span(Optional<BigInteger> parentSpanId, BigInteger spanId, String name, BigInteger traceId, long startTime, long startNanos, TraceLevel traceLevel); abstract void addAnnotation(String name); abstract void addAnnotation(String name, String message); final void end(); @Override final void close(); final BigInteger getTraceId(); final BigInteger getSpanId(); final Optional<BigInteger> getParentSpanId(); final String getName(); final String getHost(); @SuppressWarnings("UnusedDeclaration") final Integer getPid(); @Override final long getStartTime(); @Override final long getDuration(); @Override final List<AnnotationData> getAnnotations(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Span implements AutoCloseable, SpanData { public final Optional<BigInteger> getParentSpanId() { return parentSpanId; } protected  Span(Optional<BigInteger> parentSpanId, BigInteger spanId, String name, BigInteger traceId, long startTime, long startNanos, TraceLevel traceLevel); abstract void addAnnotation(String name); abstract void addAnnotation(String name, String message); final void end(); @Override final void close(); final BigInteger getTraceId(); final BigInteger getSpanId(); final Optional<BigInteger> getParentSpanId(); final String getName(); final String getHost(); @SuppressWarnings("UnusedDeclaration") final Integer getPid(); @Override final long getStartTime(); @Override final long getDuration(); @Override final List<AnnotationData> getAnnotations(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }