Search in sources :

Example 51 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class SpanEventBitFieldTest method testNextSpanId_first.

@Test
public void testNextSpanId_first() throws Exception {
    SpanEventBo spanEventBo = new SpanEventBo();
    spanEventBo.setNextSpanId(1234);
    SpanEventBitField bitField = SpanEventBitField.buildFirst(spanEventBo);
    Assert.assertTrue(bitField.isSetNextSpanId());
    bitField.setNextSpanId(false);
    Assert.assertFalse(bitField.isSetNextSpanId());
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 52 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class SpanEventBitFieldTest method testAnnotation_first.

@Test
public void testAnnotation_first() throws Exception {
    SpanEventBo spanEventBo = new SpanEventBo();
    spanEventBo.setAnnotationBoList(Lists.newArrayList(new AnnotationBo()));
    SpanEventBitField bitField = SpanEventBitField.buildFirst(spanEventBo);
    Assert.assertTrue(bitField.isSetAnnotation());
    bitField.setAnnotation(false);
    Assert.assertFalse(bitField.isSetAnnotation());
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 53 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class RedisPluginTest method pipeline.

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

Example 54 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class RedisPluginTest method binaryJedis.

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

Example 55 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class CorruptedSpanAlignFactory method get.

public SpanAlign get(final String title, final SpanBo span, final SpanEventBo spanEvent) {
    final SpanEventBo missedEvent = new SpanEventBo();
    // TODO use invalid event information ?
    missedEvent.setStartElapsed(spanEvent.getStartElapsed());
    missedEvent.setEndElapsed(spanEvent.getEndElapsed());
    missedEvent.setServiceType(ServiceType.COLLECTOR.getCode());
    List<AnnotationBo> annotations = new ArrayList<>();
    ApiMetaDataBo apiMetaData = new ApiMetaDataBo();
    apiMetaData.setLineNumber(-1);
    apiMetaData.setApiInfo("...");
    apiMetaData.setMethodTypeEnum(MethodTypeEnum.CORRUPTED);
    final AnnotationBo apiMetaDataAnnotation = new AnnotationBo();
    apiMetaDataAnnotation.setKey(AnnotationKey.API_METADATA.getCode());
    apiMetaDataAnnotation.setValue(apiMetaData);
    annotations.add(apiMetaDataAnnotation);
    final AnnotationBo argumentAnnotation = new AnnotationBo();
    argumentAnnotation.setKey(AnnotationKeyUtils.getArgs(0).getCode());
    if (System.currentTimeMillis() - span.getStartTime() < timeoutMillisec) {
        argumentAnnotation.setValue("Corrupted(waiting for packet) ");
    } else {
        if (title != null) {
            argumentAnnotation.setValue("Corrupted(" + title + ")");
        } else {
            argumentAnnotation.setValue("Corrupted");
        }
    }
    annotations.add(argumentAnnotation);
    missedEvent.setAnnotationBoList(annotations);
    return new SpanAlign(span, missedEvent);
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList) ApiMetaDataBo(com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Aggregations

SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)60 Test (org.junit.Test)28 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)14 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)9 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)9 ByteBuffer (java.nio.ByteBuffer)8 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)5 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)5 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)5 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)4 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)4 ArrayList (java.util.ArrayList)4 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)3 BasicSpan (com.navercorp.pinpoint.common.server.bo.BasicSpan)2 SpanBitFiled (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled)2 Put (org.apache.hadoop.hbase.client.Put)2 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1 SpanDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.trace.v1.SpanDecodingContext)1 SpanDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecodingContext)1 SpanEncoder (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanEncoder)1