@Test(timeout=120000) public void testConcurrency() throws IOException { Tracer tracer = newTracer(); TraceCreator traceCreator = new TraceCreator(tracer); flumeServer.alwaysOk(); traceCreator.createThreadedTrace(); }
public void pretendRpcReceiveWithTraceInfo(SpanId parentId) { try (TraceScope s = tracer.newScope("received RPC", parentId)) { importantWork1(); } } }
private void importantWork1() { try (TraceScope cur = tracer.newScope("important work 1")) { Thread.sleep((long) (2000 * Math.random())); importantWork2(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
new POJOSpanReceiver(HTraceConfiguration.EMPTY); tracer.getTracerPool().addReceiver(receiver); TraceCreator traceCreator = new TraceCreator(tracer); traceCreator.createSampleRpcTrace(); traceCreator.createSimpleTrace(); traceCreator.createThreadedTrace(); tracer.close(); TraceGraph traceGraph = new TraceGraph(receiver.getSpans());
public void pretendRpcSend() { Span span = tracer.getCurrentSpan(); pretendRpcReceiveWithTraceInfo(span.getSpanId()); }
conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT) )).build(); TraceCreator tc = new TraceCreator(tracer); tc.createThreadedTrace(); tc.createSimpleTrace(); tc.createSampleRpcTrace(); tracer.close(); Scan scan = new Scan();
@Test(timeout=120000) public void testResilience() throws IOException { Tracer tracer = newTracer(); TraceCreator traceCreator = new TraceCreator(tracer); flumeServer.alwaysFail(); traceCreator.createThreadedTrace(); } }
public void createSimpleTrace() { try (TraceScope s = tracer.newScope(SIMPLE_TRACE_ROOT)) { importantWork1(); } }
@Test public void testConcurrency() throws IOException { Tracer tracer = newTracer(new FakeZipkinTransport(){ @Override public void send(List<byte[]> spans) throws IOException { /*do nothing*/ } }); TraceCreator traceCreator = new TraceCreator(tracer); traceCreator.createThreadedTrace(); }
/** * Creates the demo trace (will create different traces from call to call). */ public void createThreadedTrace() { try (TraceScope s = tracer.newScope(THREADED_TRACE_ROOT)) { Random r = ThreadLocalRandom.current(); int numThreads = r.nextInt(4) + 1; Thread[] threads = new Thread[numThreads]; for (int i = 0; i < numThreads; i++) { threads[i] = new Thread(tracer.wrap(new MyRunnable(), null)); } for (int i = 0; i < numThreads; i++) { threads[i].start(); } for (int i = 0; i < numThreads; i++) { try { threads[i].join(); } catch (InterruptedException e) { } } importantWork1(); } }