Search in sources :

Example 1 with TAnnotation

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

the class RandomTSpan method randomTAnnotation.

public TAnnotation randomTAnnotation(int key) {
    TAnnotation tAnnotation = new TAnnotation();
    // sort order
    tAnnotation.setKey(key);
    TAnnotationValue tAnnotationValue = new TAnnotationValue();
    tAnnotationValue.setStringValue(RandomStringUtils.random(10));
    tAnnotation.setValue(tAnnotationValue);
    return tAnnotation;
}
Also used : TAnnotationValue(com.navercorp.pinpoint.thrift.dto.TAnnotationValue) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation)

Example 2 with TAnnotation

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

the class SpanFactoryAssert method assertAnnotation.

public void assertAnnotation(List<TAnnotation> tAnnotationList, List<AnnotationBo> annotationBoList) {
    if (CollectionUtils.isEmpty(tAnnotationList) && CollectionUtils.isEmpty(annotationBoList)) {
        return;
    }
    Assert.assertEquals(tAnnotationList.size(), annotationBoList.size());
    if (tAnnotationList.isEmpty()) {
        return;
    }
    for (int i = 0; i < tAnnotationList.size(); i++) {
        TAnnotation tAnnotation = tAnnotationList.get(i);
        AnnotationBo annotationBo = annotationBoList.get(i);
        Assert.assertEquals(tAnnotation.getKey(), annotationBo.getKey());
        Assert.assertEquals(tAnnotation.getValue().getStringValue(), annotationBo.getValue());
    }
}
Also used : TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation)

Example 3 with TAnnotation

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

the class SpanFactory method buildAnnotationList.

private List<AnnotationBo> buildAnnotationList(List<TAnnotation> tAnnotationList) {
    if (tAnnotationList == null) {
        return new ArrayList<AnnotationBo>();
    }
    List<AnnotationBo> boList = new ArrayList<AnnotationBo>(tAnnotationList.size());
    for (TAnnotation tAnnotation : tAnnotationList) {
        final AnnotationBo annotationBo = newAnnotationBo(tAnnotation);
        boList.add(annotationBo);
    }
    Collections.sort(boList, AnnotationComparator.INSTANCE);
    return boList;
}
Also used : ArrayList(java.util.ArrayList) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation)

Example 4 with TAnnotation

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

the class RandomTSpan method randomTSpan.

public TSpan randomTSpan() {
    final TSpan tSpan = new TSpan();
    tSpan.setAgentId("agentId");
    tSpan.setApplicationName("appName");
    tSpan.setAgentStartTime(System.currentTimeMillis());
    tSpan.setTransactionId(TransactionIdUtils.formatByteBuffer("agent", System.currentTimeMillis(), RandomUtils.nextLong(0, Long.MAX_VALUE)));
    tSpan.setSpanId(random.nextLong());
    tSpan.setParentSpanId(RandomUtils.nextInt(0, 100000));
    tSpan.setStartTime(System.currentTimeMillis() + RandomUtils.nextInt(0, 1000));
    tSpan.setElapsed(RandomUtils.nextInt(0, 2000));
    tSpan.setRpc(RandomStringUtils.random(10));
    tSpan.setServiceType(randomServerServiceType());
    tSpan.setEndPoint(RandomStringUtils.random(20));
    tSpan.setRemoteAddr(RandomStringUtils.random(20));
    List<TAnnotation> tAnnotationList = randomTAnnotationList();
    if (CollectionUtils.isNotEmpty(tAnnotationList)) {
        tSpan.setAnnotations(tAnnotationList);
    }
    tSpan.setFlag((short) RandomUtils.nextInt(0, 4));
    tSpan.setErr((short) RandomUtils.nextInt(0, 2));
    //        tSpan.setSpanEventList()
    tSpan.setParentApplicationName("parentApp");
    tSpan.setParentApplicationType(randomServerServiceType());
    tSpan.setAcceptorHost("acceptHost");
    tSpan.setApiId(RandomUtils.nextInt(0, 5000));
    if (random.nextBoolean()) {
        tSpan.setApplicationServiceType(randomServerServiceType());
    } else {
        tSpan.setApplicationServiceType(tSpan.getServiceType());
    }
    if (random.nextBoolean()) {
        TIntStringValue exceptionInfo = new TIntStringValue();
        exceptionInfo.setIntValue(RandomUtils.nextInt(0, 5000));
        exceptionInfo.setStringValue(RandomStringUtils.random(100));
        tSpan.setExceptionInfo(exceptionInfo);
    }
    tSpan.setLoggingTransactionInfo((byte) RandomUtils.nextInt(0, 256));
    return tSpan;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation)

Example 5 with TAnnotation

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

the class RandomTSpan method randomTSpanEvent.

public TSpanEvent randomTSpanEvent(short sequence) {
    TSpanEvent tSpanEvent = new TSpanEvent();
    //        @deprecated
    //        tSpanEvent.setSpanId();
    tSpanEvent.setSequence(sequence);
    tSpanEvent.setStartElapsed(RandomUtils.nextInt(0, 1000));
    tSpanEvent.setEndElapsed(RandomUtils.nextInt(0, 1000));
    tSpanEvent.setRpc(RandomStringUtils.random(10));
    //         Database (2000 ~ 2899)
    tSpanEvent.setServiceType((short) RandomUtils.nextInt(2000, 2889));
    tSpanEvent.setEndPoint(RandomStringUtils.random(10));
    List<TAnnotation> tAnnotationList = randomTAnnotationList();
    if (CollectionUtils.isNotEmpty(tAnnotationList)) {
        tSpanEvent.setAnnotations(tAnnotationList);
    }
    tSpanEvent.setDepth(RandomUtils.nextInt(0, 256));
    tSpanEvent.setNextSpanId(random.nextLong());
    tSpanEvent.setDestinationId(RandomStringUtils.random(20));
    tSpanEvent.setApiId(RandomUtils.nextInt(0, 65535));
    tSpanEvent.setAsyncId(randomNegative(RandomUtils.nextInt(0, 10)));
    tSpanEvent.setNextAsyncId(random.nextInt());
    tSpanEvent.setAsyncSequence((short) RandomUtils.nextInt(0, Short.MAX_VALUE));
    if (random.nextBoolean()) {
        TIntStringValue exceptionInfo = new TIntStringValue();
        exceptionInfo.setIntValue(RandomUtils.nextInt(0, 5000));
        exceptionInfo.setStringValue(RandomStringUtils.random(100));
        tSpanEvent.setExceptionInfo(exceptionInfo);
    }
    return tSpanEvent;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation)

Aggregations

TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)6 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)2 ExpectedAnnotation (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation)1 ExpectedSql (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedSql)1 AnnotationKey (com.navercorp.pinpoint.common.trace.AnnotationKey)1 TAnnotationValue (com.navercorp.pinpoint.thrift.dto.TAnnotationValue)1 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)1 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)1 ArrayList (java.util.ArrayList)1