Search in sources :

Example 11 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue 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)

Example 12 with TIntStringValue

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

the class SpanFactory method bind.

private void bind(SpanEventBo spanEvent, TSpanEvent tSpanEvent) {
    spanEvent.setSequence(tSpanEvent.getSequence());
    spanEvent.setStartElapsed(tSpanEvent.getStartElapsed());
    spanEvent.setEndElapsed(tSpanEvent.getEndElapsed());
    spanEvent.setRpc(tSpanEvent.getRpc());
    spanEvent.setServiceType(tSpanEvent.getServiceType());
    spanEvent.setDestinationId(tSpanEvent.getDestinationId());
    spanEvent.setEndPoint(tSpanEvent.getEndPoint());
    spanEvent.setApiId(tSpanEvent.getApiId());
    if (tSpanEvent.isSetDepth()) {
        spanEvent.setDepth(tSpanEvent.getDepth());
    }
    if (tSpanEvent.isSetNextSpanId()) {
        spanEvent.setNextSpanId(tSpanEvent.getNextSpanId());
    }
    List<AnnotationBo> annotationList = buildAnnotationList(tSpanEvent.getAnnotations());
    spanEvent.setAnnotationBoList(annotationList);
    final TIntStringValue exceptionInfo = tSpanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        spanEvent.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
    }
    if (tSpanEvent.isSetNextAsyncId()) {
        spanEvent.setNextAsyncId(tSpanEvent.getNextAsyncId());
    }
// async id
// if (localAsyncId == null) {
// if (tSpanEvent.isSetAsyncId()) {
// spanEvent.setAsyncId(tSpanEvent.getAsyncId());
// }
// if (tSpanEvent.isSetAsyncSequence()) {
// spanEvent.setAsyncSequence(tSpanEvent.getAsyncSequence());
// }
// } else {
// spanEvent.setAsyncId(localAsyncId.getAsyncId());
// spanEvent.setAsyncSequence((short) localAsyncId.getSequence());
// }
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo)

Example 13 with TIntStringValue

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

the class SpanThriftMessageConverter method buildTSpan.

@VisibleForTesting
TSpan buildTSpan(Span span) {
    final TSpan tSpan = new TSpan();
    // tSpan.setVersion(span.getVersion());
    tSpan.setApplicationName(applicationName);
    tSpan.setAgentId(agentId);
    tSpan.setAgentStartTime(agentStartTime);
    tSpan.setApplicationServiceType(applicationServiceType);
    final TraceRoot traceRoot = span.getTraceRoot();
    final TraceId traceId = traceRoot.getTraceId();
    final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
    tSpan.setTransactionId(transactionId);
    tSpan.setSpanId(traceId.getSpanId());
    tSpan.setParentSpanId(traceId.getParentSpanId());
    tSpan.setStartTime(span.getStartTime());
    tSpan.setElapsed(span.getElapsedTime());
    tSpan.setServiceType(span.getServiceType());
    tSpan.setRemoteAddr(span.getRemoteAddr());
    final Shared shared = traceRoot.getShared();
    tSpan.setRpc(shared.getRpcName());
    tSpan.setEndPoint(shared.getEndPoint());
    tSpan.setFlag(traceId.getFlags());
    tSpan.setErr(shared.getErrorCode());
    tSpan.setParentApplicationName(span.getParentApplicationName());
    tSpan.setParentApplicationType(span.getParentApplicationType());
    tSpan.setAcceptorHost(span.getAcceptorHost());
    tSpan.setApiId(span.getApiId());
    final IntStringValue exceptionInfo = span.getExceptionInfo();
    if (exceptionInfo != null) {
        TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);
        tSpan.setExceptionInfo(tIntStringValue);
    }
    tSpan.setLoggingTransactionInfo(shared.getLoggingInfo());
    final List<Annotation<?>> annotations = span.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);
        tSpan.setAnnotations(tAnnotations);
    }
    spanPostProcessor.preProcess(span, tSpan);
    final List<SpanEvent> spanEventList = span.getSpanEventList();
    if (CollectionUtils.hasLength(spanEventList)) {
        final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
        tSpan.setSpanEventList(tSpanEvents);
    }
    spanPostProcessor.postProcess(span, tSpan);
    return tSpan;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) Shared(com.navercorp.pinpoint.profiler.context.id.Shared) ByteBuffer(java.nio.ByteBuffer) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Aggregations

TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)13 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)3 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)2 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)2 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)2 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)2 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 DataType (com.navercorp.pinpoint.common.util.DataType)1 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)1 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)1 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)1 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)1 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)1