Package com.twitter.zipkin.gen

Examples of com.twitter.zipkin.gen.Span


    @Test
    public void testCollect() throws TTransportException {

        final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT);
        try {
            final Span span = new Span();
            span.setId(SPAN_ID);
            span.setTrace_id(TRACE_ID);
            span.setName(SPAN_NAME);
            zipkinSpanCollector.collect(span);

        } finally {
            zipkinSpanCollector.close();
        }
View Full Code Here


    public void testCollectWithDefaultAnnotation() throws TTransportException {

        final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT);
        zipkinSpanCollector.addDefaultAnnotation(KEY1, VALUE1);
        try {
            final Span span = new Span();
            span.setId(SPAN_ID);
            span.setTrace_id(TRACE_ID);
            span.setName(SPAN_NAME);
            zipkinSpanCollector.collect(span);

        } finally {
            zipkinSpanCollector.close();
        }
        final List<Span> serverCollectedSpans = zipkinCollectorServer.getReceivedSpans();
        assertEquals(1, serverCollectedSpans.size());
        final Span span = serverCollectedSpans.get(0);
        assertEquals(SPAN_ID, span.getId());
        assertEquals(TRACE_ID, span.getTrace_id());
        assertEquals(SPAN_NAME, span.getName());
        final List<BinaryAnnotation> binary_annotations = span.getBinary_annotations();
        assertEquals("Expect default annotation to have been submitted.", 1, binary_annotations.size());
        final BinaryAnnotation binaryAnnotation = binary_annotations.get(0);
        assertEquals(KEY1, binaryAnnotation.getKey());
        assertEquals(VALUE1, new String(binaryAnnotation.getValue()));
View Full Code Here

        params.setBatchSize(50);

        final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT, params);
        try {

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

            for (int i = 1; i <= FIRST_BURST_OF_SPANS; i++) {
                LOGGER.info("Submitting Span nr " + i + "/" + FIRST_BURST_OF_SPANS);
                zipkinSpanCollector.collect(span);
            }
View Full Code Here

        params.setBatchSize(50);

        final ZipkinSpanCollector zipkinSpanCollector = new ZipkinSpanCollector("localhost", PORT, params);
        try {

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

            for (int i = 1; i <= hunderdTen; i++) {
                LOGGER.info("Submitting Span nr " + i + "/" + hunderdTen);
                zipkinSpanCollector.collect(span);
            }
View Full Code Here

        int subsequentEmptyBatches = 0;
        do {

            try {
                final Span span = queue.poll(5, TimeUnit.SECONDS);
                if (span == null) {
                    subsequentEmptyBatches++;

                } else {
                    logEntries.add(create(span));
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void setServerSend() {
        final Span currentSpan = state.getCurrentServerSpan().getSpan();
        if (currentSpan != null) {
            submitAnnotation(zipkinCoreConstants.SERVER_SEND);
            final long threadDuration = state.getServerSpanThreadDuration();
            if (threadDuration > 0) {
                submitBinaryAnnotation(BraveAnnotations.THREAD_DURATION, String.valueOf(threadDuration));
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public void setClientReceived() {

        final Span currentSpan = getSpan();
        if (currentSpan != null) {
            submitAnnotation(zipkinCoreConstants.CLIENT_RECV);
            spanCollector.collect(currentSpan);
            state.setCurrentClientSpan(null);
            state.setCurrentClientServiceName(null);
View Full Code Here

                }
            }
        }

        final SpanId newSpanId = getNewSpanId();
        final Span newSpan = new Span();
        newSpan.setId(newSpanId.getSpanId());
        newSpan.setTrace_id(newSpanId.getTraceId());
        if (newSpanId.getParentSpanId() != null) {
            newSpan.setParent_id(newSpanId.getParentSpanId());
        }
        newSpan.setName(requestName);
        state.setCurrentClientSpan(newSpan);
        return newSpanId;
    }
View Full Code Here

        return Collections.unmodifiableList(traceFilters);
    }

    private SpanId getNewSpanId() {

        final Span currentServerSpan = state.getCurrentServerSpan().getSpan();
        final long newSpanId = randomGenerator.nextLong();
        if (currentServerSpan == null) {
            return new SpanIdImpl(newSpanId, newSpanId, null);
        }

        return new SpanIdImpl(currentServerSpan.getTrace_id(), newSpanId, currentServerSpan.getId());
    }
View Full Code Here

public class EmptySpanCollectorImplTest {

    @Test
    public void testCollect() {
        final EmptySpanCollectorImpl emptySpanCollectorImpl = new EmptySpanCollectorImpl();
        final Span mockSpan = mock(Span.class);
        emptySpanCollectorImpl.collect(mockSpan);
        verifyNoMoreInteractions(mockSpan);
    }
View Full Code Here

TOP

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

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.