private String generateSubParentLevelId(Span spanData) { if (spanData.getParentLevel() == null || spanData.getParentLevel().length() == 0) { return spanData.getLevelId() + ""; } return spanData.getParentLevel() + "." + spanData.getLevelId(); }
public ContextData beforeInvoke(Identification id) { try { Span spanData = ContextGenerator.generateSpanFromThreadLocal(id); // 设置SpanType的类型 spanData.setTag(Tag.SPAN_TYPE, SpanType.RPC_CLIENT); if (Config.BuriedPoint.PRINTF) { logger.debug( "TraceId:" + spanData.getTraceId() + "\tParentLevelId:" + spanData.getParentLevel() + "\tLevelId:" + spanData.getLevelId() + "\tbusinessKey:" + spanData.getBusinessKey()); } CurrentThreadSpanStack.push(spanData); sendRequestSpan(spanData, id); return new ContextData( spanData.getTraceId(), generateSubParentLevelId(spanData), spanData.getRouteKey()); } catch (Throwable t) { logger.error(t.getMessage(), t); return new EmptyContextData(); } }