alibaba / Sentinel

A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
https://sentinelguard.io/
Apache License 2.0
22.28k stars 7.99k forks source link

springboot2.7.5版本@SentinelRestTemplate不生效 #2941

Open XW512 opened 1 year ago

XW512 commented 1 year ago

我的版本如下:

2.7.5 2021.0.4.0 2021.0.4

发现@SentinelRestTemplate放在restTemplate中不生效,feign之间的调用倒是没什么问题,求解答,我猜测是版本不兼容, 能否给一个兼容版本,我使用了官网推荐的 springboot版本是2.6.11,也是不生效

sczyh30 commented 1 year ago

For Spring Cloud Alibaba Sentinel, you may submit an issue in https://github.com/alibaba/spring-cloud-alibaba/issues

XW512 commented 1 year ago

For Spring Cloud Alibaba Sentinel, you may submit an issue in https://github.com/alibaba/spring-cloud-alibaba/issues

OK,I'll ask the issue to go there

sczyh30 commented 1 year ago

Keep track on https://github.com/alibaba/spring-cloud-alibaba/issues/2894

steverao commented 1 year ago

I found this might be a sentinel problem. My test codes as below:

@GetMapping("/rt")
public String rt() {
      return restTemplate.getForObject("https://httpbin.org/delay/1", String.class);
 }
# degrade rule
{
    "resource": "/rt",
    "count": 1,
    "grade": 0,
    "timeWindow": 30000
  }

In sentinel 1.7.1, request will be degraded. But in sentinel 1.8.1, rule won't be degraded.

XW512 commented 1 year ago

Hello, is there a version to solve this problem?

XW512 commented 1 year ago

I tried to introduce Sentinel-core instead of spring-cloud-alibaba, and found that the 1.8.6 slow call ratio of Sentinel-core is not effective. If this version is changed to 1.6.4, it can be effective. Is there anything done by Sentinel that causes the fuse to fail to take effect? Is there any concern about this problem

XW512 commented 1 year ago

I tried the 1.7.2 version of Sentinel-core. The fuse can take effect. The upgrade to 1.8.0 does not take effect. It should not take effect after 1.8.0

XW512 commented 1 year ago

@sczyh30 Hello, can you help me look at this first?

dowenliu-xyz commented 1 month ago

I found this might be a sentinel problem. My test codes as below:

@GetMapping("/rt")
public String rt() {
      return restTemplate.getForObject("https://httpbin.org/delay/1", String.class);
 }
# degrade rule
{
    "resource": "/rt",
    "count": 1,
    "grade": 0,
    "timeWindow": 30000
  }

In sentinel 1.7.1, request will be degraded. But in sentinel 1.8.1, rule won't be degraded.

This code doesn't seem to have anything to do with @SentinelRestTemplate.