Examples of Span


Examples of com.twitter.zipkin.gen.Span

        assertNotNull(newSpanId);
        assertEquals(PARENT_TRACE_ID, newSpanId.getTraceId());
        assertEquals(1l, newSpanId.getSpanId());
        assertEquals(Long.valueOf(PARENT_SPAN_ID), newSpanId.getParentSpanId());

        final Span expectedSpan = new Span();
        expectedSpan.setTrace_id(PARENT_TRACE_ID);
        expectedSpan.setId(1);
        expectedSpan.setParent_id(PARENT_SPAN_ID);
        expectedSpan.setName(REQUEST_NAME);

        verify(mockState).sample();
        verify(mockRandom, times(1)).nextLong();
        verify(mockState).getCurrentServerSpan();
        verify(mockState).setCurrentClientSpan(expectedSpan);
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

    private Span span;

    @Before
    public void setup() {
        executorService = Executors.newFixedThreadPool(4);
        span = new Span();
    }
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

        };
    }

    @Test
    public void testCollect() {
        final Span mockSpan = mock(Span.class);
        spanCollector.collect(mockSpan);
        verify(mockLogger).isInfoEnabled();
        verifyNoMoreInteractions(mockLogger, mockSpan);
    }
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

    @Test
    public void testCollectAfterAddingDefaultAnnotations() {

        spanCollector.addDefaultAnnotation(KEY1, VALUE1);

        final Span mockSpan = mock(Span.class);
        spanCollector.collect(mockSpan);

        // Create expected annotation.
        final BinaryAnnotation expectedBinaryAnnoration = create(KEY1, VALUE1);
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

    public void testCollectAfterAddingTwoDefaultAnnotations() {

        spanCollector.addDefaultAnnotation(KEY1, VALUE1);
        spanCollector.addDefaultAnnotation(KEY2, VALUE2);

        final Span mockSpan = mock(Span.class);
        spanCollector.collect(mockSpan);

        // Create expected annotations.
        final BinaryAnnotation expectedBinaryAnnoration = create(KEY1, VALUE1);
        final BinaryAnnotation expectedBinaryAnnoration2 = create(KEY2, VALUE2);
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

     * @param parentSpanId Parent span id, can be <code>null</code>.
     * @param name Span name.
     */
    ServerSpanImpl(final long traceId, final long spanId, final Long parentSpanId, final String name) {

        span = new Span();
        span.setTrace_id(traceId);
        span.setId(spanId);
        if (parentSpanId != null) {
            span.setParent_id(parentSpanId);
        }
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

                final byte[] decodedSpan = base64.decode(logEntry.getMessage());

                final ByteArrayInputStream buf = new ByteArrayInputStream(decodedSpan);
                final TProtocolFactory factory = new TBinaryProtocol.Factory();
                final TProtocol proto = factory.getProtocol(new TIOStreamTransport(buf));
                final Span span = new Span();
                span.read(proto);
                spans.add(span);
            }

            if (delayMs > 0) {
                try {
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

    @Test
    public void testFailOnSetupFalse() throws TTransportException, InterruptedException {
        final ZipkinSpanCollectorParams params = new ZipkinSpanCollectorParams();
        params.setFailOnSetup(false);

        final Span span = new Span();
        span.setId(SPAN_ID);
        span.setTrace_id(TRACE_ID);
        span.setName(SPAN_NAME);

        // Should not throw exception but log error.
        final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT, params);

        zipkinSpanCollector.collect(span);
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

            serverTracer.setServerSend();

            final List<Span> collectedSpans = mockSpanCollector.getCollectedSpans();
            assertEquals("Expected 2 collected spans.", 2, collectedSpans.size());
            final Span clientSpan = collectedSpans.get(0);
            final Span serverSpan = collectedSpans.get(1);

            assertTrue(serverSpan.getTrace_id() != 0);
            assertTrue(serverSpan.getId() != 0);
            assertTrue(serverSpan.getParent_id() != 0);

            assertTrue(clientSpan.getTrace_id() != 0);
            assertTrue(clientSpan.getId() != 0);
            assertTrue(clientSpan.getParent_id() != 0);

            assertEquals("Should belong to same trace.", serverSpan.getTrace_id(), clientSpan.getTrace_id());
            assertTrue("Span ids should be different.", serverSpan.getId() != clientSpan.getId());
            assertEquals("Parent span id of client span should be equal to server span id.", serverSpan.getId(),
                clientSpan.getParent_id());

            assertEquals("Expect sr, ss and 1 custom annotation.", 3, serverSpan.getAnnotations().size());
            assertEquals(2, clientSpan.getAnnotations().size());

            return 2;

        }
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

        final ClientResponse<Void> response = (ClientResponse<Void>)client.a();
        try {
            assertEquals(200, response.getStatus());
            final List<Span> collectedSpans = SpanCollectorForTesting.getInstance().getCollectedSpans();
            assertEquals(2, collectedSpans.size());
            final Span clientSpan = collectedSpans.get(0);
            final Span serverSpan = collectedSpans.get(1);

            assertEquals("Expected trace id's to be equal", clientSpan.getTrace_id(), serverSpan.getTrace_id());
            assertEquals("Expected span id's to be equal", clientSpan.getId(), serverSpan.getId());
            assertEquals("Expected parent span id's to be equal", clientSpan.getParent_id(), serverSpan.getParent_id());
            assertEquals("Span names of client and server should be equal.", clientSpan.getName(), serverSpan.getName());
            assertEquals("Expect 2 annotations.", 2, clientSpan.getAnnotations().size());
            assertEquals("Expect 2 annotations.", 2, serverSpan.getAnnotations().size());
            assertEquals("service name of end points for both client and server annotations should be equal.", clientSpan
                .getAnnotations().get(0).getHost().getService_name(), serverSpan.getAnnotations().get(0).getHost()
                .getService_name());

        } finally {
            response.releaseConnection();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.