Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

网关的流控和熔断页面无法正常显示

Open bryanxtong opened this issue 10 months ago • 2 comments

Issue Description

Type: bug report

Describe what happened

Spring Cloud Alibaba 2023.0.1.0 集成 Sentinel Dashboard 时,网关(Gateway)的流控和熔断页面能正常显示 Gateway 定制版的规则管理界面。

Spring Cloud Alibaba 2023.0.3.3 下,Sentinel Dashboard 只能显示 普通版 的规则管理界面,无法识别 Gateway 模块。

Describe what you expected to happen

Spring Cloud Alibaba 2023.0.3.3 ,可以正常显示网关流控和熔断页面

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

run the attachments below and problems will occur for dashboard 1.8..8

Tell us your environment

    spring-cloud.version  2023.0.3
    spring.cloud.alibaba.version 2023.0.3.3
    Spring Boot 3.3.10

Anything else we need to know?

bryanxtong avatar Apr 22 '25 06:04 bryanxtong

gateway-circuitbreaker.zip demo projects to help identify the problems.

bryanxtong avatar Apr 22 '25 10:04 bryanxtong

1.The jar com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2023.0.3.3 changes the way to initilize the configuration with SentinelApplicationContextInitializer and not the same as the old way com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration(2023.0.1).

  1. comment the code below in SentinelApplicationContextInitializer.java and move to SentinelAutoConfiguration.java

if (properties.isEager()) { InitExecutor.doInit(); }

===> `
public class SentinelAutoConfiguration {

@Autowired
private SentinelProperties properties;

/**
 * InitExecutor.doInit() will invoke the SentinelConfig static block which will then evaluate the csp.sentinel.app.type=11
 * If applied in SentinelApplicationContextInitializer, the csp.sentinel.app.type is not set in SentinelSCGAutoConfiguration and
 * give value zero
 */
@PostConstruct
public void init() {
    // earlier initialize
    if (properties.isEager()) {
        InitExecutor.doInit();
    }
}

} `

bryanxtong avatar Apr 23 '25 03:04 bryanxtong