use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanThriftMessageConverter method buildTSpanChunk.
@VisibleForTesting
TSpanChunk buildTSpanChunk(SpanChunk spanChunk) {
final TSpanChunk tSpanChunk = new TSpanChunk();
tSpanChunk.setApplicationName(applicationName);
tSpanChunk.setAgentId(agentId);
tSpanChunk.setAgentStartTime(agentStartTime);
tSpanChunk.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = spanChunk.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
tSpanChunk.setTransactionId(transactionId);
tSpanChunk.setSpanId(traceId.getSpanId());
final Shared shared = traceRoot.getShared();
tSpanChunk.setEndPoint(shared.getEndPoint());
if (spanChunk instanceof AsyncSpanChunk) {
final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
final TLocalAsyncId tLocalAsyncId = new TLocalAsyncId(localAsyncId.getAsyncId(), localAsyncId.getSequence());
tSpanChunk.setLocalAsyncId(tLocalAsyncId);
}
spanPostProcessor.preProcess(spanChunk, tSpanChunk);
final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
tSpanChunk.setSpanEventList(tSpanEvents);
}
spanPostProcessor.postProcess(spanChunk, tSpanChunk);
return tSpanChunk;
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanThriftMessageConverter method buildTSpanEventList.
private List<TSpanEvent> buildTSpanEventList(List<SpanEvent> spanEventList) {
final int eventSize = spanEventList.size();
final List<TSpanEvent> tSpanEventList = new ArrayList<>(eventSize);
for (SpanEvent spanEvent : spanEventList) {
final TSpanEvent tSpanEvent = buildTSpanEvent(spanEvent);
tSpanEventList.add(tSpanEvent);
}
return tSpanEventList;
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanStreamUDPSenderTest method createSpanChunk.
private SpanChunk createSpanChunk(int spanEventSize) throws InterruptedException {
SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory("applicationName", "agentId", 0, ServiceType.STAND_ALONE);
List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
SpanChunk spanChunk = spanChunkFactory.create(originalSpanEventList);
return spanChunk;
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanStreamUDPSenderTest method createSpanEventList.
private List<SpanEvent> createSpanEventList(int size) throws InterruptedException {
// Span span = new SpanBo(new TSpan());
Span span = new Span();
List<SpanEvent> spanEventList = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
SpanEvent spanEvent = new SpanEvent(span);
spanEvent.markStartTime();
Thread.sleep(1);
spanEvent.markAfterTime();
spanEventList.add(spanEvent);
}
return spanEventList;
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class PluginTestAgent method verifyIsLoggingTransactionInfo.
@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
Object actual = popSpan();
Span span = null;
if (actual instanceof Span) {
span = (Span) actual;
} else if (actual instanceof SpanEvent) {
span = ((SpanEvent) actual).getSpan();
} else {
throw new IllegalArgumentException("Unexpected type: " + getActual(actual));
}
if (span.getLoggingTransactionInfo() != loggingInfo.getCode()) {
LoggingInfo loggingTransactionInfo = LoggingInfo.searchByCode(span.getLoggingTransactionInfo());
if (loggingTransactionInfo != null) {
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but was [" + loggingTransactionInfo.getName() + "]. expected: " + loggingInfo.getName() + ", was: " + loggingTransactionInfo.getName());
} else {
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but loggingTransactionInfo value invalid.");
}
}
}
Aggregations