Package com.twitter.zipkin.gen

Examples of com.twitter.zipkin.gen.Span$SpanTupleScheme


     * @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


                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

    @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

            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

        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

        assertNull(serverSpanImpl.getSpan());
    }

    @Test
    public void testGetSpan() {
        final Span span = serverSpan.getSpan();
        assertNotNull(span);
        assertEquals(TRACE_ID, span.getTrace_id());
        assertEquals(SPAN_ID, span.getId());
        assertEquals(PARENT_SPAN_ID.longValue(), span.getParent_id());
        assertEquals(NAME, span.getName());
        assertNull(span.getAnnotations());
        assertNull(span.getBinary_annotations());

    }
View Full Code Here

        final Response response = target.request().get();
        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());
    }
View Full Code Here

        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);

        for (final Annotation annotation : span.getAnnotations()) {
            int duration = annotation.getDuration();
            if (duration > 0) {
                duration = duration / 1000; // Convert from micro- to milliseconds
                final String value = annotation.getValue();
                final int equalSignIndex = value.indexOf("=");
View Full Code Here

TOP

Related Classes of com.twitter.zipkin.gen.Span$SpanTupleScheme

Copyright © 2018 www.massapicom. 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.