Search in sources :

Example 26 with TSpanEvent

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

the class SpanStreamSendDataPlanerTest method getSpanEventList.

private List<TSpanEvent> getSpanEventList(PartitionedByteBufferLocator partitionedByteBufferLocator, SpanStreamSendDataFactory factory) throws Exception {
    List<TSpanEvent> spanEventList = new ArrayList<TSpanEvent>();
    SpanChunkStreamSendDataPlaner planer = new SpanChunkStreamSendDataPlaner(partitionedByteBufferLocator, factory);
    Iterator<SpanStreamSendData> iterator = planer.getSendDataIterator();
    while (iterator.hasNext()) {
        SpanStreamSendData data = iterator.next();
        ByteBuffer[] sendBuffers = data.getSendBuffers();
        byte[] relatedBuffer = getSpanRelatedBuffer(sendBuffers);
        List<TSpanEvent> result = deserialize(relatedBuffer);
        for (TSpanEvent spanEvent : result) {
            spanEventList.add(spanEvent);
        }
    }
    return spanEventList;
}
Also used : SpanStreamSendData(com.navercorp.pinpoint.profiler.sender.SpanStreamSendData) ArrayList(java.util.ArrayList) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) ByteBuffer(java.nio.ByteBuffer)

Example 27 with TSpanEvent

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

the class ReplaceListCompactProtocolTest method before.

@Before
public void before() {
    // add dummy span-event list
    List<TSpanEvent> spanEventList = new ArrayList<TSpanEvent>();
    spanEventList.add(new TSpanEvent());
    span.setSpanEventList(spanEventList);
    span.setSpanEventListIsSet(true);
    // init byte buffer
    Arrays.fill(buf, Byte.valueOf("0"));
}
Also used : ArrayList(java.util.ArrayList) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Before(org.junit.Before)

Example 28 with TSpanEvent

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

the class TBaseStreamTest method newSpanChunk.

public TSpanChunk newSpanChunk() {
    final TSpanChunk spanChunk = new TSpanChunk();
    spanChunk.setAgentId(AGENT_ID);
    spanChunk.setAgentIdIsSet(true);
    spanChunk.setApplicationName(APPLICATION_NAME);
    spanChunk.setApplicationNameIsSet(true);
    spanChunk.setAgentStartTime(START_TIME);
    spanChunk.setAgentStartTimeIsSet(true);
    spanChunk.setServiceType(SERVICE_TYPE);
    spanChunk.setServiceTypeIsSet(true);
    spanChunk.setTransactionId(TRANSACTION_ID);
    spanChunk.setTransactionIdIsSet(true);
    spanChunk.setSpanId(1);
    spanChunk.setSpanIdIsSet(true);
    List<TSpanEvent> list = new ArrayList<TSpanEvent>();
    list.add(newSpanEvent());
    list.add(newSpanEvent());
    list.add(newSpanEvent());
    spanChunk.setSpanEventList(list);
    spanChunk.setSpanEventListIsSet(true);
    return spanChunk;
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) ArrayList(java.util.ArrayList) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Example 29 with TSpanEvent

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

the class TBaseStreamTest method write.

@Test
public void write() throws Exception {
    TBaseStream stream = new TBaseStream(DEFAULT_PROTOCOL_FACTORY);
    // single span event
    TSpanEvent spanEvent = newSpanEvent();
    stream.write(spanEvent);
    int size = stream.size();
    // append
    stream.write(spanEvent);
    assertEquals(size * 2, stream.size());
}
Also used : TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Test(org.junit.Test)

Example 30 with TSpanEvent

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

the class TSpanMockBuilder method buildEvent.

public TSpanEvent buildEvent(int size) {
    TSpanEvent spanEvent = new TSpanEvent();
    spanEvent.setApiId(1);
    spanEvent.setApiIdIsSet(true);
    spanEvent.setDepth(1);
    spanEvent.setDepthIsSet(true);
    byte[] buffer = new byte[size];
    Arrays.fill(buffer, (byte) 1);
    spanEvent.setDestinationId(new String(buffer));
    spanEvent.setDestinationIdIsSet(true);
    return spanEvent;
}
Also used : TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Aggregations

TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)30 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)9 ByteBuffer (java.nio.ByteBuffer)8 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)7 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)6 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)4 HeaderTBaseDeserializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory)4 HeaderTBaseSerializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory)4 Span (com.navercorp.pinpoint.profiler.context.Span)3 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)3 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)2 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)2 PartitionedByteBufferLocator (com.navercorp.pinpoint.profiler.sender.PartitionedByteBufferLocator)2 SpanStreamSendData (com.navercorp.pinpoint.profiler.sender.SpanStreamSendData)2 SpanStreamSendDataFactory (com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataFactory)2 SpanStreamSendDataSerializer (com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataSerializer)2 TBase (org.apache.thrift.TBase)2 TException (org.apache.thrift.TException)2 RandomTSpan (com.navercorp.pinpoint.common.server.bo.RandomTSpan)1