Search in sources :

Example 6 with VisibleForTesting

use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.

the class SpanThriftMessageConverter method buildTAnnotation.

@VisibleForTesting
List<TAnnotation> buildTAnnotation(List<? extends Annotation<?>> annotations) {
    final List<TAnnotation> tAnnotationList = new ArrayList<>(annotations.size());
    for (Annotation<?> annotation : annotations) {
        final TAnnotation tAnnotation = new TAnnotation(annotation.getKey());
        final TAnnotationValue tAnnotationValue = annotationMapper.buildTAnnotationValue(annotation);
        if (tAnnotationValue != null) {
            tAnnotation.setValue(tAnnotationValue);
        }
        tAnnotationList.add(tAnnotation);
    }
    return tAnnotationList;
}
Also used : ArrayList(java.util.ArrayList) TAnnotationValue(com.navercorp.pinpoint.thrift.dto.TAnnotationValue) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 7 with VisibleForTesting

use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.

the class SpanThriftMessageConverter method buildTSpanEvent.

@VisibleForTesting
TSpanEvent buildTSpanEvent(SpanEvent spanEvent) {
    final TSpanEvent tSpanEvent = new TSpanEvent();
    // tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());
    if (spanEvent.getElapsedTime() != 0) {
        tSpanEvent.setEndElapsed(spanEvent.getElapsedTime());
    }
    tSpanEvent.setSequence((short) spanEvent.getSequence());
    // tSpanEvent.setRpc(spanEvent.getRpc());
    tSpanEvent.setServiceType(spanEvent.getServiceType());
    tSpanEvent.setEndPoint(spanEvent.getEndPoint());
    // tSpanEvent.setAnnotations();
    if (spanEvent.getDepth() != -1) {
        tSpanEvent.setDepth(spanEvent.getDepth());
    }
    if (spanEvent.getNextSpanId() != -1) {
        tSpanEvent.setNextSpanId(spanEvent.getNextSpanId());
    }
    tSpanEvent.setDestinationId(spanEvent.getDestinationId());
    tSpanEvent.setApiId(spanEvent.getApiId());
    final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);
        tSpanEvent.setExceptionInfo(tIntStringValue);
    }
    final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();
    if (asyncIdObject != null) {
        tSpanEvent.setNextAsyncId(asyncIdObject.getAsyncId());
    }
    final List<Annotation<?>> annotations = spanEvent.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);
        tSpanEvent.setAnnotations(tAnnotations);
    }
    return tSpanEvent;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TLocalAsyncId(com.navercorp.pinpoint.thrift.dto.TLocalAsyncId) AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 8 with VisibleForTesting

use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.

the class GrpcSpanMessageConverter method buildPAnnotation.

@VisibleForTesting
List<PAnnotation> buildPAnnotation(List<Annotation<?>> annotations) {
    final List<PAnnotation> tAnnotationList = new ArrayList<>(annotations.size());
    for (Annotation<?> annotation : annotations) {
        final PAnnotation.Builder builder = getAnnotationBuilder();
        builder.setKey(annotation.getKey());
        final PAnnotationValue pAnnotationValue = grpcAnnotationValueMapper.buildPAnnotationValue(annotation);
        if (pAnnotationValue != null) {
            builder.setValue(pAnnotationValue);
        }
        PAnnotation pAnnotation = builder.build();
        tAnnotationList.add(pAnnotation);
    }
    return tAnnotationList;
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) ArrayList(java.util.ArrayList) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 9 with VisibleForTesting

use of com.navercorp.pinpoint.common.annotations.VisibleForTesting 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 10 with VisibleForTesting

use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.

the class SpanFactory method fastLocalAsyncIdBo.

@VisibleForTesting
LocalAsyncIdBo fastLocalAsyncIdBo(List<TSpanEvent> tSpanEventList) {
    final TSpanEvent first = tSpanEventList.get(0);
    if (isSetAsyncId(first)) {
        final int asyncId = first.getAsyncId();
        final short asyncSequence = first.getAsyncSequence();
        return new LocalAsyncIdBo(asyncId, asyncSequence);
    }
    return null;
}
Also used : LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)15 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)6 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)5 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)4 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)4 LocalAsyncId (com.navercorp.pinpoint.profiler.context.LocalAsyncId)4 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)4 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)4 PAnnotation (com.navercorp.pinpoint.grpc.trace.PAnnotation)3 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)3 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)3 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)2 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)2 PLocalAsyncId (com.navercorp.pinpoint.grpc.trace.PLocalAsyncId)2 PTransactionId (com.navercorp.pinpoint.grpc.trace.PTransactionId)2 AsyncId (com.navercorp.pinpoint.profiler.context.AsyncId)2 AsyncSpanChunk (com.navercorp.pinpoint.profiler.context.AsyncSpanChunk)2 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)2 TLocalAsyncId (com.navercorp.pinpoint.thrift.dto.TLocalAsyncId)2