Search in sources :

Example 36 with SpanEvent

use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.

the class SpanProcessorV1 method postEventProcess.

@VisibleForTesting
public void postEventProcess(List<SpanEvent> spanEventList, List<TSpanEvent> tSpanEventList, long keyTime) {
    if (CollectionUtils.isEmpty(spanEventList)) {
        return;
    }
    if (!(CollectionUtils.nullSafeSize(spanEventList) == CollectionUtils.nullSafeSize(tSpanEventList))) {
        throw new IllegalStateException("list size not same, spanEventList=" + CollectionUtils.nullSafeSize(spanEventList) + ", tSpanEventList=" + CollectionUtils.nullSafeSize(tSpanEventList));
    }
    // check list type
    assert spanEventList instanceof RandomAccess;
    final int listSize = spanEventList.size();
    for (int i = 0; i < listSize; i++) {
        final SpanEvent spanEvent = spanEventList.get(i);
        final TSpanEvent tSpanEvent = tSpanEventList.get(i);
        final long startTime = spanEvent.getStartTime();
        final long startElapsedTime = startTime - keyTime;
        tSpanEvent.setStartElapsed((int) startElapsedTime);
    }
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) RandomAccess(java.util.RandomAccess) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 37 with SpanEvent

use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.

the class SpanProcessorV1 method postProcess.

@Override
public void postProcess(Span span, TSpan tSpan) {
    final TraceRoot traceRoot = span.getTraceRoot();
    final long keyTime = traceRoot.getTraceStartTime();
    List<SpanEvent> spanEventList = span.getSpanEventList();
    if (spanEventList == null) {
        spanEventList = Collections.emptyList();
    }
    List<TSpanEvent> tSpanEventList = tSpan.getSpanEventList();
    if (tSpanEventList == null) {
        tSpanEventList = Collections.emptyList();
    }
    postEventProcess(spanEventList, tSpanEventList, keyTime);
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Example 38 with SpanEvent

use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.

the class JedisPluginTest method binaryJedis.

@Test
public void binaryJedis() {
    JedisMock jedis = new JedisMock("localhost", 6379);
    try {
        jedis.get("foo".getBytes());
    } finally {
        close(jedis);
    }
    final List<SpanEvent> events = getCurrentSpanEvents();
    assertEquals(1, events.size());
    final SpanEvent eventBo = events.get(0);
    assertEquals(HOST + ":" + PORT, eventBo.getEndPoint());
    assertEquals("REDIS", eventBo.getDestinationId());
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) BasePinpointTest(com.navercorp.pinpoint.test.junit4.BasePinpointTest) Test(org.junit.Test)

Example 39 with SpanEvent

use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.

the class OrderedSpanRecorder method handleSpanEvent.

private void handleSpanEvent(SpanChunk spanChunk) {
    List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
    if (spanEventList.size() != 1) {
        throw new IllegalStateException("spanEvent.size != 1");
    }
    final SpanEvent event = spanEventList.get(0);
    long startTime = event.getStartTime();
    Item<SpanType> item = new Item<SpanType>(spanChunk, startTime, spanChunk.getTraceRoot(), event.getSequence());
    insertItem(item);
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent)

Example 40 with SpanEvent

use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.

the class ApplicationContextHandler method addApiDescription.

private void addApiDescription(List<String> list, List<SpanEvent> spanEventList) {
    for (SpanEvent spanEvent : spanEventList) {
        int apiId = spanEvent.getApiId();
        String apiDescription = this.tcpDataSender.getApiDescription(apiId);
        list.add(apiDescription);
    }
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent)

Aggregations

SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)49 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)23 Test (org.junit.Test)20 Span (com.navercorp.pinpoint.profiler.context.Span)18 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)10 ArrayList (java.util.ArrayList)10 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)9 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)7 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)6 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)6 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)5 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)5 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)5 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)4 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)3 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)3 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)3