use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class GrpcSpanProcessorV2Test method preProcess.
@Test
public void preProcess() {
Span span = newSpan();
SpanEventBuilder factory = new SpanEventBuilder();
factory.addSpanEvent();
factory.addSpanEvent();
factory.addSpanEvent();
List<SpanEvent> original = factory.getSpanEventList();
factory.shuffle();
Assert.assertNotEquals(factory.getSpanEventList(), span.getSpanEventList());
span.setSpanEventList(factory.getSpanEventList());
spanProcessorProtoV2.preProcess(span, PSpan.newBuilder());
Assert.assertEquals(original, span.getSpanEventList());
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanPostProcessorTest method postProcess2.
@Test
public void postProcess2() {
SpanProcessor<TSpan, TSpanChunk> spanChunkPostProcessor = new SpanProcessorV1();
TraceRoot internalTraceId = newInternalTraceId();
List<TSpanEvent> tSpanEvents = new ArrayList<TSpanEvent>();
TSpanChunk tSpanChunk = new TSpanChunk();
tSpanChunk.setSpanEventList(tSpanEvents);
List<SpanEvent> spanEvents = new ArrayList<SpanEvent>();
SpanChunk spanChunk = new DefaultSpanChunk(internalTraceId, spanEvents);
// one spanEvent
addSpanEvent(tSpanEvents, spanEvents);
spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
// two spanEvent
addSpanEvent(tSpanEvents, spanEvents);
spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
// three
addSpanEvent(tSpanEvents, spanEvents);
spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class PostgreSQLConnectionIT method execute.
@Test
public void execute() throws SQLException {
Connection connection = null;
try {
connection = createConnection(container.getJdbcUrl(), container.getUsername(), container.getPassword());
statement(connection);
preparedStatement2(connection);
preparedStatement3(connection);
preparedStatement4(connection);
preparedStatement5(connection);
// preparedStatement6(connection);
preparedStatement7(connection);
preparedStatement8(connection);
List<SpanEvent> currentSpanEvents = getCurrentSpanEvents();
logger.debug("{}", currentSpanEvents);
} finally {
close(connection);
}
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent 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