/** * Wrapper method to add timeline annotiation to current span with given message */ public static void addTimelineAnnotation(String msg) { Span span = Tracer.getCurrentSpan(); if (span != null) { span.addTimelineAnnotation(msg); } }
call.traceScope.reattach(); traceScope = call.traceScope; traceScope.getSpan().addTimelineAnnotation("called"); LOG.info(Thread.currentThread().getName() + " unexpectedly interrupted", e); if (traceScope != null) { traceScope.getSpan().addTimelineAnnotation("unexpectedly interrupted: " + StringUtils.stringifyException(e)); LOG.info(Thread.currentThread().getName() + " caught an exception", e); if (traceScope != null) { traceScope.getSpan().addTimelineAnnotation("Exception: " + StringUtils.stringifyException(e));
span.addTimelineAnnotation("IPC client connecting to " + server); span.addTimelineAnnotation("IPC client connected to " + server);
public void addTimelineAnnotation(String msg) { span.addTimelineAnnotation(msg); }
public void addTimelineAnnotation(String msg) { span.addTimelineAnnotation(msg); }
public void addTimelineAnnotation(String msg) { span.addTimelineAnnotation(msg); }
/** * Wrapper method to add timeline annotiation to current span with given message */ public static void addTimelineAnnotation(String msg) { Span span = Tracer.getCurrentSpan(); if (span != null) { span.addTimelineAnnotation(msg); } }
/** * Wrapper method to add timeline annotiation to current span with given message */ public static void addTimelineAnnotation(String msg) { Span span = Tracer.getCurrentSpan(); if (span != null) { span.addTimelineAnnotation(msg); } }
call.traceScope.reattach(); traceScope = call.traceScope; traceScope.getSpan().addTimelineAnnotation("called"); LOG.info(Thread.currentThread().getName() + " unexpectedly interrupted", e); if (traceScope != null) { traceScope.getSpan().addTimelineAnnotation("unexpectedly interrupted: " + StringUtils.stringifyException(e)); LOG.info(Thread.currentThread().getName() + " caught an exception", e); if (traceScope != null) { traceScope.getSpan().addTimelineAnnotation("Exception: " + StringUtils.stringifyException(e));
Span span = Tracer.getCurrentSpan(); if (span != null) { span.addTimelineAnnotation("dataQueue.wait"); Span span = Tracer.getCurrentSpan(); if ((span != null) && (!firstWait)) { span.addTimelineAnnotation("end.wait");
@Override public String call() throws InterruptedException { startLatch.countDown(); // Prevent any task from exiting until every task has started assertTrue(continueLatch.await(WAIT_TIME_SECONDS, TimeUnit.SECONDS)); // Annotate on the presumed child trace Tracer.getCurrentSpan().addTimelineAnnotation( Thread.currentThread().getName()); return Tracer.getCurrentSpan().getDescription(); } };
span.addTimelineAnnotation("IPC client connecting to " + server); span.addTimelineAnnotation("IPC client connected to " + server);
long annoStartTime = System.currentTimeMillis() * 1000; Thread.sleep(500); ms.addTimelineAnnotation("anno"); Thread.sleep(500); long annoEndTime = System.currentTimeMillis() * 1000;
@Test(timeout=120000) public void testSimpleTraces() throws IOException, InterruptedException { Tracer tracer = newTracer(); Span rootSpan = new MilliSpan.Builder(). description("root"). spanId(new SpanId(100, 100)). tracerId("test"). begin(System.currentTimeMillis()). build(); TraceScope rootScope = tracer.newScope("root"); TraceScope innerOne = tracer.newScope("innerOne"); TraceScope innerTwo = tracer.newScope("innerTwo"); innerTwo.close(); Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("innerTwo")); innerOne.close(); Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("innerOne")); rootSpan.addKVAnnotation("foo", "bar"); rootSpan.addTimelineAnnotation("timeline"); rootScope.close(); Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("root")); tracer.close(); }
@Test public void testSimpleTraces() throws IOException, InterruptedException { FakeZipkinTransport transport = new FakeZipkinTransport(); Tracer tracer = newTracer(transport); Span rootSpan = new MilliSpan.Builder(). description("root"). spanId(new SpanId(100, 100)). tracerId("test"). begin(System.currentTimeMillis()). build(); TraceScope rootScope = tracer.newScope("root"); TraceScope innerOne = tracer.newScope("innerOne"); TraceScope innerTwo = tracer.newScope("innerTwo"); innerTwo.close(); Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("innerTwo")); innerOne.close(); Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("innerOne")); rootSpan.addKVAnnotation("foo", "bar"); rootSpan.addTimelineAnnotation("timeline"); rootScope.close(); Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("root")); tracer.close(); }
@Test public void testHTraceToZipkin() throws IOException { Span rootSpan = new MilliSpan.Builder(). description(ROOT_SPAN_DESC). parents(new SpanId[] { } ). spanId(new SpanId(100, 100)). tracerId("test"). begin(System.currentTimeMillis()). build(); Span innerOne = rootSpan.child("Some good work"); Span innerTwo = innerOne.child("Some more good work"); innerTwo.stop(); innerOne.stop(); rootSpan.addKVAnnotation("foo", "bar"); rootSpan.addTimelineAnnotation("timeline"); rootSpan.stop(); for (Span s : new Span[] {rootSpan, innerOne, innerTwo}) { com.twitter.zipkin.gen.Span zs = new HTraceToZipkinConverter(12345, (short) 12).convert(s); assertSpansAreEquivalent(s, zs); } }