未验证 提交 de81e211 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge pull request #881 from ascrutae/fix/entry-span-issue

[Agent] fix create entry span failure
......@@ -248,35 +248,33 @@ public class TracingContext implements AbstractTracerContext {
AbstractSpan entrySpan;
final AbstractSpan parentSpan = peek();
final int parentSpanId = parentSpan == null ? -1 : parentSpan.getSpanId();
if (parentSpan == null) {
if (parentSpan != null && parentSpan.isEntry()) {
entrySpan = (AbstractTracingSpan)DictionaryManager.findOperationNameCodeSection()
.findOnly(segment.getApplicationId(), operationName)
.doInCondition(new PossibleFound.FoundAndObtain() {
@Override public Object doProcess(int operationId) {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationId);
return parentSpan.setOperationId(operationId);
}
}, new PossibleFound.NotFoundAndObtain() {
@Override public Object doProcess() {
return new EntrySpan(spanIdGenerator++, parentSpanId, operationName);
return parentSpan.setOperationName(operationName);
}
});
entrySpan.start();
return push(entrySpan);
} else if (parentSpan.isEntry()) {
return entrySpan.start();
} else {
entrySpan = (AbstractTracingSpan)DictionaryManager.findOperationNameCodeSection()
.findOnly(segment.getApplicationId(), operationName)
.doInCondition(new PossibleFound.FoundAndObtain() {
@Override public Object doProcess(int operationId) {
return parentSpan.setOperationId(operationId);
return new EntrySpan(spanIdGenerator++, parentSpanId, operationId);
}
}, new PossibleFound.NotFoundAndObtain() {
@Override public Object doProcess() {
return parentSpan.setOperationName(operationName);
return new EntrySpan(spanIdGenerator++, parentSpanId, operationName);
}
});
return entrySpan.start();
} else {
throw new IllegalStateException("The Entry Span can't be the child of Non-Entry Span");
entrySpan.start();
return push(entrySpan);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册