Search in sources :

Example 21 with SpanEvent

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

the class JedisPluginTest method jedis.

@Test
public void jedis() {
    JedisMock jedis = new JedisMock("localhost", 6379);
    try {
        jedis.get("foo");
    } 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 22 with SpanEvent

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

the class JedisPluginTest method pipeline.

@Test
public void pipeline() {
    JedisMock jedis = new JedisMock("localhost", 6379);
    try {
        Pipeline pipeline = jedis.pipelined();
        pipeline.get("foo");
    } finally {
        close(jedis);
    }
    final List<SpanEvent> events = getCurrentSpanEvents();
    assertEquals(1, events.size());
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) Pipeline(redis.clients.jedis.Pipeline) BasePinpointTest(com.navercorp.pinpoint.test.junit4.BasePinpointTest) Test(org.junit.Test)

Example 23 with SpanEvent

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

the class PluginVerifierExternalAdaptor method getServiceTypeCode.

private short getServiceTypeCode(SpanType spanType) {
    if (spanType instanceof Span) {
        final Span span = (Span) spanType;
        return span.getServiceType();
    }
    if (spanType instanceof SpanChunk) {
        final SpanChunk spanChunk = (SpanChunk) spanType;
        List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
        if (spanEventList.size() != 1) {
            throw new IllegalStateException("unexpected spanEventList.size() !=1");
        }
        SpanEvent spanEvent = spanEventList.get(0);
        return spanEvent.getServiceType();
    }
    return -1;
}
Also used : SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 24 with SpanEvent

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

the class BasePinpointTest method getCurrentSpanEvents.

protected List<SpanEvent> getCurrentSpanEvents() {
    List<SpanEvent> spanEvents = new ArrayList<>();
    for (SpanType value : this.tBaseRecorder) {
        if (value instanceof SpanChunk) {
            final SpanChunk spanChunk = (SpanChunk) value;
            for (SpanEvent tSpanEvent : spanChunk.getSpanEventList()) {
                SpanEvent spanEvent = tSpanEvent;
                spanEvents.add(spanEvent);
            }
        }
    }
    return spanEvents;
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) ArrayList(java.util.ArrayList)

Example 25 with SpanEvent

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

the class ApplicationContextHandler method getExecutedMethod.

public List<String> getExecutedMethod() {
    List<String> list = new ArrayList<>();
    for (SpanType item : orderedSpanRecorder) {
        if (item instanceof Span) {
            Span span = (Span) item;
            List<SpanEvent> spanEventList = span.getSpanEventList();
            addApiDescription(list, spanEventList);
        } else if (item instanceof SpanChunk) {
            SpanChunk spanChunk = (SpanChunk) item;
            List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
            addApiDescription(list, spanEventList);
        }
    }
    return list;
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) ArrayList(java.util.ArrayList) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) ArrayList(java.util.ArrayList) List(java.util.List) Span(com.navercorp.pinpoint.profiler.context.Span)

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