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;
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations