测试代码:
@RestController
@Slf4j
public class TestController {
@Autowired
private TestService testService;
@GetMapping("/test-a")
@SentinelResource(value = "test-a")
public String testA() {
return this.testService.common() + "a";
}
@GetMapping("/test-b")
@SentinelResource(value = "test-b")
public String testB() {
return this.testService.common() + "b";
}
}
@Service
class TestService {
@SentinelResource(value = "common")
public String common() {
return "common";
}
}
复现步骤:
- 依次访问 /test-a、/test-b端点。
- 然后查看
localhost:8719/tree
Sentinel 1.6.3 tree端点展示如下:
EntranceNode: machine-root(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
-EntranceNode: sentinel_web_servlet_context(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
--/test-a(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
---test-a(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
----common(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
--/favicon.ico(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
--/test-b(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
---test-b(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
-EntranceNode: sentinel_default_context(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
t:threadNum pq:passQps bq:blockQps tq:totalQps rt:averageRt prq: passRequestQps 1mp:1m-pass 1mb:1m-block 1mt:1m-total
可以看到,common资源不会挂到test-b下面去。
换用Sentinel 1.5.2 tree端点展示如下:
EntranceNode: machine-root(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:28 1mb:0 1mt:28)
-EntranceNode: /test-b(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:7 1mb:0 1mt:7)
--/test-b(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:7 1mb:0 1mt:7)
---test-b(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:7 1mb:0 1mt:7)
----common(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:7 1mb:0 1mt:7)
-EntranceNode: sentinel_default_context(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:0 1mb:0 1mt:0)
-EntranceNode: /favicon.ico(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:11 1mb:0 1mt:11)
--/favicon.ico(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:11 1mb:0 1mt:11)
-EntranceNode: /test-a(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:10 1mb:0 1mt:10)
--/test-a(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:10 1mb:0 1mt:10)
---test-a(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:10 1mb:0 1mt:10)
----common(t:0 pq:0.0 bq:0.0 tq:0.0 rt:0.0 prq:0.0 1mp:10 1mb:0 1mt:10)
t:threadNum pq:passQps bq:blockQps tq:totalQps rt:averageRt prq: passRequestQps 1mp:1m-pass 1mb:1m-block 1mt:1m-total
于是,Sentinel Dashboard上展示也不对,我觉得是Sentinel 1.6.3的Bug,帮忙修正下。
测试代码:
复现步骤:
localhost:8719/treeSentinel 1.6.3 tree端点展示如下:
可以看到,common资源不会挂到test-b下面去。
换用Sentinel 1.5.2 tree端点展示如下:
于是,Sentinel Dashboard上展示也不对,我觉得是Sentinel 1.6.3的Bug,帮忙修正下。