alibaba / Sentinel

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

sentinel dashboard 是否考虑做成类似 `@EnableEurekaServer` 的形式,提供 `@EnableSentinelDashboard` #2512

Open zhangyunan1994 opened 2 years ago

zhangyunan1994 commented 2 years ago

Issue Description

feature request

Describe what happened (or what feature you want)

sentinel dashboard 是否考虑做成类似 Spring Cloud Eureka Server 的部署方式,比如

@SpringBootApplication
@EnableSentinelDashboard
public class DashboardApplication {
    public static void main(String[] args) {
        SpringApplication.run(DashboardApplication.class, args);
    }
}

然后通过一些配置项来确定规则的改动保存在何种存储中(内存、zookeeper、nacos、redis ...) 这样做可以简化二次配置的难度,也能防止用户在二次改造的时候出现问题

预期改造效果如下

一、提供一个 starter 并能通过注解开启功能

  1. 提供 spring-boot-alibaba-sentinel-dashboard-starter
  2. 提供 @EnableSentinelDashboard

启动方式如下:

@SpringBootApplication
@EnableSentinelDashboard
public class DashboardApplication {
    public static void main(String[] args) {
        SpringApplication.run(DashboardApplication.class, args);
    }
}

二、通过配置可以选择不同的存储方式

sentinel:
  dashboard:
    cluster: false
    datasource:
      nacos:
        namespace: 3c6f4b6a-511a-42cd-b1dd-35e2523216ac
        server-addr: nacos.cn:80
        group: DEFAULT_GROUP
        username: nacos
        password: nacos

Describe what you expected to happen

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

Tell us your environment

Anything else we need to know?

su-yh commented 2 years ago

dashboard 它就是一个控制台服务器,如果你不用控制台你不启动服务就好了呀。如果你启动了服务,为什么还要关闭它呢? 搞不清楚你的逻辑是什么。

zhangyunan1994 commented 2 years ago

改成这种方式主要是为了减少改造的出错率,如果只把 dashboard 的数据保存在内存中,是不需要进行改造的。如果想把规则保存在其他数据源中,需要自行就行改造,并且文档中提供了一部分改造的例子,如果想把集群流控的功能也生效的话,依然需要修改 dashboard 的源码。这样如果以后既需要维护自己的改造的代码,又要去查看 alibaba/sentinel 是否新增了功能或者解决了 bug, 最后需要维护两份代码。同事自己改造源码也需要进行测试,也存在一部分风险。

zhangyunan1994 commented 2 years ago

如果改成类似 Spring Cloud Eureka Server 的部署方式,既能统一一下改造的版本,又能提供一些标准化的改造方案,同时作为开源项目,大家也可以一起找改造后的 bug, 这样更容易将项目落地。预期改造效果如下

一、提供一个 starter 并能通过注解开启功能

  1. 提供 spring-boot-alibaba-sentinel-dashboard-starter
  2. 提供 @EnableSentinelDashboard

启动方式如下:

@SpringBootApplication
@EnableSentinelDashboard
public class DashboardApplication {
    public static void main(String[] args) {
        SpringApplication.run(DashboardApplication.class, args);
    }
}

二、通过配置可以选择不同的存储方式

sentinel:
  dashboard:
    cluster: false
    datasource:
      nacos:
        namespace: 3c6f4b6a-511a-42cd-b1dd-35e2523216ac
        server-addr: nacos.cn:80
        group: DEFAULT_GROUP
        username: nacos
        password: nacos
su-yh commented 2 years ago

改成这种方式主要是为了减少改造的出错率,如果只把 dashboard 的数据保存在内存中,是不需要进行改造的。如果想把规则保存在其他数据源中,需要自行就行改造,并且文档中提供了一部分改造的例子,如果想把集群流控的功能也生效的话,依然需要修改 dashboard 的源码。这样如果以后既需要维护自己的改造的代码,又要去查看 alibaba/sentinel 是否新增了功能或者解决了 bug, 最后需要维护两份代码。同事自己改造源码也需要进行测试,也存在一部分风险。

我这边用了这个dashboard 一段时间之后,我感觉官方提供的这个dashboard 控制台,仅仅是一个参考,它里面有很多东西都没实现,与实际使用相比需要做不少的优化,最重要的一点就是集群部署。它并不适合直接拿来做生产项目,所以我更感觉它只是一个示例,估计官方应该不会对这个进行过多的支持。 我们这边也没有使用spring-cloud-starter-alibaba-sentinel 因为它这里面也会有一些小问题。

zhangyunan1994 commented 2 years ago

嗯,是的和文档比,dashboard 功能并不完善。spring-cloud-starter-alibaba-sentinel 中也未提供集群的功能