use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.
the class GrpcSpanMessageConverter method buildPSpanChunk.
@VisibleForTesting
PSpanChunk buildPSpanChunk(SpanChunk spanChunk) {
final PSpanChunk.Builder pSpanChunk = PSpanChunk.newBuilder();
pSpanChunk.setVersion(SpanVersion.TRACE_V2);
// tSpanChunk.setApplicationName(applicationName);
// tSpanChunk.setAgentId(agentId);
// tSpanChunk.setAgentStartTime(agentStartTime);
pSpanChunk.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = spanChunk.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final PTransactionId transactionId = newTransactionId(traceId);
pSpanChunk.setTransactionId(transactionId);
pSpanChunk.setSpanId(traceId.getSpanId());
final Shared shared = traceRoot.getShared();
final String endPoint = shared.getEndPoint();
if (endPoint != null) {
pSpanChunk.setEndPoint(endPoint);
}
if (spanChunk instanceof AsyncSpanChunk) {
final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
final PLocalAsyncId.Builder pAsyncIdBuilder = PLocalAsyncId.newBuilder();
pAsyncIdBuilder.setAsyncId(localAsyncId.getAsyncId());
pAsyncIdBuilder.setSequence(localAsyncId.getSequence());
final PLocalAsyncId pLocalAsyncId = pAsyncIdBuilder.build();
pSpanChunk.setLocalAsyncId(pLocalAsyncId);
}
this.spanProcessor.preProcess(spanChunk, pSpanChunk);
final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<PSpanEvent> pSpanEvents = buildPSpanEventList(spanEventList);
pSpanChunk.addAllSpanEvent(pSpanEvents);
}
this.spanProcessor.postProcess(spanChunk, pSpanChunk);
return pSpanChunk.build();
}
use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.
the class GrpcSpanMessageConverter method buildPSpanEvent.
@VisibleForTesting
public PSpanEvent.Builder buildPSpanEvent(SpanEvent spanEvent) {
final PSpanEvent.Builder pSpanEvent = getSpanEventBuilder();
// tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());
if (spanEvent.getElapsedTime() != 0) {
pSpanEvent.setEndElapsed(spanEvent.getElapsedTime());
}
pSpanEvent.setSequence(spanEvent.getSequence());
// tSpanEvent.setRpc(spanEvent.getRpc());
pSpanEvent.setServiceType(spanEvent.getServiceType());
// tSpanEvent.setAnnotations();
if (spanEvent.getDepth() != -1) {
pSpanEvent.setDepth(spanEvent.getDepth());
}
pSpanEvent.setApiId(spanEvent.getApiId());
final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();
if (exceptionInfo != null) {
PIntStringValue pIntStringValue = buildPIntStringValue(exceptionInfo);
pSpanEvent.setExceptionInfo(pIntStringValue);
}
final PNextEvent nextEvent = buildNextEvent(spanEvent);
if (nextEvent != null) {
pSpanEvent.setNextEvent(nextEvent);
}
final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();
if (asyncIdObject != null) {
pSpanEvent.setAsyncEvent(asyncIdObject.getAsyncId());
}
final List<Annotation<?>> annotations = spanEvent.getAnnotations();
if (CollectionUtils.hasLength(annotations)) {
final List<PAnnotation> pAnnotations = buildPAnnotation(annotations);
pSpanEvent.addAllAnnotation(pAnnotations);
}
return pSpanEvent;
}
use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.
the class GrpcSpanMessageConverter method buildPSpan.
@VisibleForTesting
PSpan buildPSpan(Span span) {
final PSpan.Builder pSpan = PSpan.newBuilder();
pSpan.setVersion(SpanVersion.TRACE_V2);
pSpan.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = span.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final PTransactionId transactionId = newTransactionId(traceId);
pSpan.setTransactionId(transactionId);
pSpan.setSpanId(traceId.getSpanId());
pSpan.setParentSpanId(traceId.getParentSpanId());
pSpan.setStartTime(span.getStartTime());
pSpan.setElapsed(span.getElapsedTime());
pSpan.setServiceType(span.getServiceType());
PAcceptEvent pAcceptEvent = newAcceptEvent(span);
pSpan.setAcceptEvent(pAcceptEvent);
pSpan.setFlag(traceId.getFlags());
Shared shared = span.getTraceRoot().getShared();
pSpan.setErr(shared.getErrorCode());
pSpan.setApiId(span.getApiId());
final IntStringValue exceptionInfo = span.getExceptionInfo();
if (exceptionInfo != null) {
PIntStringValue pIntStringValue = buildPIntStringValue(exceptionInfo);
pSpan.setExceptionInfo(pIntStringValue);
}
pSpan.setLoggingTransactionInfo(shared.getLoggingInfo());
final List<Annotation<?>> annotations = span.getAnnotations();
if (CollectionUtils.hasLength(annotations)) {
final List<PAnnotation> tAnnotations = buildPAnnotation(annotations);
pSpan.addAllAnnotation(tAnnotations);
}
this.spanProcessor.preProcess(span, pSpan);
final List<SpanEvent> spanEventList = span.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<PSpanEvent> pSpanEvents = buildPSpanEventList(spanEventList);
pSpan.addAllSpanEvent(pSpanEvents);
}
this.spanProcessor.postProcess(span, pSpan);
return pSpan.build();
}
use of com.navercorp.pinpoint.common.annotations.VisibleForTesting in project pinpoint by naver.
the class HbaseHostApplicationMapDao method createRowKey0.
@VisibleForTesting
static byte[] createRowKey0(String parentApplicationName, short parentServiceType, long statisticsRowSlot, String parentAgentId) {
// even if a agentId be added for additional specifications, it may be safe to scan rows.
// But is it needed to add parentAgentServiceType?
final int SIZE = HbaseTableConstants.APPLICATION_NAME_MAX_LEN + 2 + 8;
final Buffer rowKeyBuffer = new AutomaticBuffer(SIZE);
rowKeyBuffer.putPadString(parentApplicationName, HbaseTableConstants.APPLICATION_NAME_MAX_LEN);
rowKeyBuffer.putShort(parentServiceType);
rowKeyBuffer.putLong(TimeUtils.reverseTimeMillis(statisticsRowSlot));
// rowKeyBuffer.putPadString(parentAgentId, HbaseTableConstants.AGENT_NAME_MAX_LEN);
return rowKeyBuffer.getBuffer();
}
use of com.navercorp.pinpoint.common.annotations.VisibleForTesting 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;
}
Aggregations