Skip to content

Commit 496afa8

Browse files
committed
refactor(health): 移除健康检查相关功能
删除健康检查处理器、健康检查器及相关路由和前端组件,简化系统架构
1 parent 34a15bc commit 496afa8

File tree

8 files changed

+4
-1209
lines changed

8 files changed

+4
-1209
lines changed

internal/handler/health.go

Lines changed: 0 additions & 185 deletions
This file was deleted.

internal/initapp/init.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type AppComponents struct {
3838
SecurityHandler *handler.SecurityHandler
3939
AuthHandler *handler.AuthHandler
4040
MetricsHandler *handler.MetricsHandler
41-
HealthHandler *handler.HealthHandler
4241
PathStatsHandler *handler.PathStatsHandler
4342
// Routes
4443
AdminHandler router.RouteHandler
@@ -203,9 +202,6 @@ func createHandlers(components *AppComponents) error {
203202
// 创建指标处理器
204203
components.MetricsHandler = handler.NewMetricsHandler(components.MetricsService)
205204

206-
// 创建健康检查处理器
207-
components.HealthHandler = handler.NewHealthHandler(components.ProxyHandler.GetProxyService())
208-
209205
// 创建路径统计处理器
210206
components.PathStatsHandler = handler.NewPathStatsHandler(metrics.GetCollector())
211207

@@ -225,7 +221,6 @@ func setupRoutes(components *AppComponents) error {
225221
components.MirrorHandler,
226222
components.ConfigHandler,
227223
components.SecurityHandler,
228-
components.HealthHandler,
229224
components.PathStatsHandler,
230225
)
231226
components.MainRoutes = router.SetupMainRoutes(components.MirrorHandler, components.ProxyHandler)

internal/router/admin_router.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Route struct {
1717
}
1818

1919
// SetupAdminRoutes 设置管理员路由
20-
func SetupAdminRoutes(proxyHandler *handler.ProxyHandler, authHandler *handler.AuthHandler, metricsHandler *handler.MetricsHandler, mirrorHandler *handler.MirrorProxyHandler, configHandler *handler.ConfigHandler, securityHandler *handler.SecurityHandler, healthHandler *handler.HealthHandler, pathStatsHandler *handler.PathStatsHandler) ([]Route, RouteHandler) {
20+
func SetupAdminRoutes(proxyHandler *handler.ProxyHandler, authHandler *handler.AuthHandler, metricsHandler *handler.MetricsHandler, mirrorHandler *handler.MirrorProxyHandler, configHandler *handler.ConfigHandler, securityHandler *handler.SecurityHandler, pathStatsHandler *handler.PathStatsHandler) ([]Route, RouteHandler) {
2121
// 定义API路由
2222
apiRoutes := []Route{
2323
{http.MethodGet, "/admin/api/auth", authHandler.LoginHandler, false},
@@ -36,9 +36,6 @@ func SetupAdminRoutes(proxyHandler *handler.ProxyHandler, authHandler *handler.A
3636
{http.MethodPost, "/admin/api/cache/clear-by-path", handler.NewCacheAdminHandler(proxyHandler.Cache, mirrorHandler.Cache).ClearCacheByPath, true},
3737
{http.MethodGet, "/admin/api/cache/config", handler.NewCacheAdminHandler(proxyHandler.Cache, mirrorHandler.Cache).GetCacheConfig, true},
3838
{http.MethodPost, "/admin/api/cache/config", handler.NewCacheAdminHandler(proxyHandler.Cache, mirrorHandler.Cache).UpdateCacheConfig, true},
39-
{http.MethodGet, "/admin/api/health/status", healthHandler.GetHealthStatus, true},
40-
{http.MethodPost, "/admin/api/health/reset", healthHandler.ResetTargetHealth, true},
41-
{http.MethodPost, "/admin/api/health/clear", healthHandler.ClearAllHealth, true},
4239
{http.MethodGet, "/admin/api/path-stats", pathStatsHandler.GetAllPathStats, true},
4340
{http.MethodPost, "/admin/api/path-stats/reset", pathStatsHandler.ResetPathStats, true},
4441
{http.MethodPost, "/admin/api/path-stats/reset-all", pathStatsHandler.ResetAllPathStats, true},

0 commit comments

Comments
 (0)