alibaba/Sentinel

sentinel-dashboard 的监控数据持久化扩展方式希望可以更优雅一些

Open

#408 opened on Jan 11, 2019

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Java (23,109 stars) (8,150 forks)batch import
area/dashboardgood first issuekind/enhancement

Description

Issue Description

Type: feature request

Describe what happened (or what feature you want)

sentinel-dashboard的监控数据持久化扩展方式必须通过修改源码的替换 MetricsRepository 的实现

// Sentinel-dashboard's monitoring data persistence extension must be implemented by modifying the source code to replace MetricsRepository

Describe what you expected to happen

可以实现类似 Spring Boot 条件bean,只在不存在用户自定义的 MetricsRepository 实现时采用 InMemoryMetricsRepository 实现。

好处有:

  1. 自定义实现时用户可以在 sentinel-dashboard 中添加一个自定义实现的jar(META-INF/spring.factories 中实现自动注入其他持久化实现)即可实现数据持久化的切换。
  2. 这样 sentinel-dashboard 升级后,只需要引入jar,重新打包即可,无需修改sentinel-dashboard源码,更进一步,用户可以不用重新打包,在启动命令中将该自定义jar加入类路径这样可以实现sentinel-dashboard与自定义jar分离,升级无任何依赖。

// English translation:

Mechanism like Spring Boot conditional bean can be implemented, using the InMemoryMetricsRepository implementation only when there is no user-defined MetricsRepository implementation.

The benefits are:

  1. In the custom implementation, users can add a custom implementation jar in the sentinel-dashboard (automatically inject other persistence implementations in META-INF/spring.factories) to achieve data persistence switching.
  2. After the upgrade of the sentinel-dashboard, you only need to introduce the jar and repackage it. You don't need to modify the sentinel-dashboard source code. Further, the user can repackage the custom jar in the startup command. Sentinel-dashboard is separated from the custom jar, the upgrade has no dependencies.

Contributor guide