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