alibaba / alibaba/Sentinel

Node Tree Lack | 调用链 不完整

Open
#2,467 0 comments 0 reactions 0 assignees View on GitHub
kind/question
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

*bug report*

### Describe what happened (or what feature you want)

* First, when I want to construct one invocation tree like following :

![image](https://user-images.githubusercontent.com/5186869/143844670-4a4556ae-d1c3-41af-853c-af479a24f141.png)

* then, there is in-complete tree i get by invoking DefaultNode.printDefaultNode();

* following is what i got:
```
Entry-entrance(t:0 pq:2.0 bq:0.0 tq:2.0 rt:3.5 1mp:2 1mb:0 1mt:2)
-nodeB(thread:0 pq:1.0 bq:0.0 tq:1.0 rt:0.0 1mp:1 1mb:0 1mt:1)
-nodeA(thread:0 pq:1.0 bq:0.0 tq:1.0 rt:7.0 1mp:1 1mb:0 1mt:1)
--nodeC(thread:0 pq:2.0 bq:0.0 tq:2.0 rt:0.0 1mp:2 1mb:0 1mt:2)
```

### Describe what you expected to happen

* I thing there must be something wrong with the design of NodeSelectSlot.
* There should be a complete invocation tree.

### How to reproduce it (as minimally and precisely as possible)

* following is my testing code:
```
@Test
public void invocationChain() {
Context context = ContextUtil.enter("entrance");

nodeA();
nodeB();

context.getEntranceNode().printDefaultNode();
context.exit();
}

private void nodeA() {
if (SphO.entry("nodeA")) {
try {
nodeC();
} finally {
SphO.exit();
}
}
}

private void nodeB() {
if (SphO.entry("nodeB")) {
try {
nodeC();
} finally {
SphO.exit();
}
}
}

private void nodeC() {
if (SphO.entry("nodeC")) {
try {
System.out.println("nodeC");
} finally {
SphO.exit();
}
}
}

static {
List list = Lists.newArrayList(Arrays.asList("nodeA", "nodeB", "nodeC"));
List rules = Lists.newArrayList();
for(String str : list) {
FlowRule rule1 = new FlowRule();
rule1.setResource(str);
rule1.setCount(2);
rule1.setGrade(RuleConstant.FLOW_GRADE_QPS);
rule1.setLimitApp("default");
rules.add(rule1);
}
FlowRuleManager.loadRules(rules);
}
```

### Tell us your environment

* java 1.8
* Sentinel 1.8.2

### Anything else we need to know?

* nothing

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the invocationChain test and inspect DefaultNode.printDefaultNode(), the ContextUtil.enter flow, and NodeSelectSlot behavior around SphO.entry and SphO.exit. Trace the node relationships for nodeA, nodeB, and nodeC, then add or update a regression test showing that the printed invocation tree is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.