Search in sources :

Example 1 with TSpan

use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.

the class NetworkAvailabilityCheckPacketFilterTest method testFilter_Continue.

@Test
public void testFilter_Continue() throws Exception {
    SocketAddress localSocketAddress = senderSocket.getLocalSocketAddress();
    logger.debug("localSocket:{}", localSocketAddress);
    TSpan skip = new TSpan();
    boolean skipResult = filter.filter(receiverSocket, skip, null);
    Assert.assertEquals(skipResult, TBaseFilter.CONTINUE);
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.Test)

Example 2 with TSpan

use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.

the class SpanStreamSendDataSerializer method copySpanWithoutSpanEvent.

private TSpan copySpanWithoutSpanEvent(TSpan span) {
    TSpan copiedSpan = span.deepCopy();
    copiedSpan.setSpanEventList(Collections.EMPTY_LIST);
    return copiedSpan;
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan)

Example 3 with TSpan

use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.

the class ChunkHeaderBufferedTBaseSerializer method addTSpan.

// TSpan = TSpan + TSpanChunk
private void addTSpan(TBase<?, ?> base) throws TException {
    final TSpan span = (TSpan) base;
    if (span.getSpanEventList() == null) {
        write(base);
        return;
    }
    try {
        for (TSpanEvent e : span.getSpanEventList()) {
            eventStream.write(e);
        }
        write(span, FIELD_NAME_SPAN_EVENT_LIST, eventStream.split(chunkSize));
        while (!eventStream.isEmpty()) {
            final TSpanChunk spanChunk = toSpanChunk(span);
            write(spanChunk, FIELD_NAME_SPAN_EVENT_LIST, eventStream.split(chunkSize));
        }
    } finally {
        eventStream.clear();
    }
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Example 4 with TSpan

use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.

the class SpanFactoryTest method testTransactionId_include_agentId.

@Test
public void testTransactionId_include_agentId() throws Exception {
    TSpan tSpan = new TSpan();
    tSpan.setAgentId("agentId");
    byte[] transactionIdBytes = TransactionIdUtils.formatBytes("transactionAgentId", 1, 2);
    tSpan.setTransactionId(transactionIdBytes);
    SpanBo spanBo = spanFactory.newSpanBo(tSpan);
    TransactionId transactionId = spanBo.getTransactionId();
    Assert.assertEquals(transactionId.getAgentId(), "transactionAgentId");
    Assert.assertEquals(transactionId.getAgentStartTime(), 1);
    Assert.assertEquals(transactionId.getTransactionSequence(), 2);
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 5 with TSpan

use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.

the class SpanHandler method handleSimple.

public void handleSimple(TBase<?, ?> tbase) {
    if (!(tbase instanceof TSpan)) {
        throw new IllegalArgumentException("unexpected tbase:" + tbase + " expected:" + this.getClass().getName());
    }
    try {
        final TSpan tSpan = (TSpan) tbase;
        if (logger.isDebugEnabled()) {
            logger.debug("Received SPAN={}", tSpan);
        }
        final SpanBo spanBo = spanFactory.buildSpanBo(tSpan);
        traceDao.insert(spanBo);
        applicationTraceIndexDao.insert(tSpan);
        // insert statistics info for server map
        insertAcceptorHost(spanBo);
        insertSpanStat(spanBo);
        insertSpanEventStat(spanBo);
    } catch (Exception e) {
        logger.warn("Span handle error. Caused:{}. Span:{}", e.getMessage(), tbase, e);
    }
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo)

Aggregations

TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)16 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)6 Test (org.junit.Test)6 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)2 Span (com.navercorp.pinpoint.profiler.context.Span)2 RandomTSpan (com.navercorp.pinpoint.common.server.bo.RandomTSpan)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)1 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)1 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)1 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)1 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)1 HeaderTBaseDeserializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory)1 HeaderTBaseSerializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 TException (org.apache.thrift.TException)1