Fix admin services display (#20099)

This commit is contained in:
Wang Qi
2026-09-23 15:54:57 +08:00
committed by GitHub
parent 329d365873
commit 35b9b4354d
3 changed files with 21 additions and 22 deletions
+3 -3
View File
@@ -849,7 +849,7 @@ func runIngestor(ctx context.Context, cancel context.CancelFunc, serverName stri
// Start heartbeat reporter to admin server
if hb := startHeartbeat(
common.ServerTypeIngestion,
fmt.Sprintf("ingestor-%s", ingestor.ID()),
fmt.Sprintf("ingestor-%s", ingestor.ID()[:8]),
0,
globalConfig.GetHeartbeatInterval(),
); hb != nil {
@@ -903,7 +903,7 @@ func runSyncer(ctx context.Context, cancel context.CancelFunc, serverName string
// Start heartbeat reporter to admin server
if hb := startHeartbeat(
common.ServerTypeFileSyncer,
fmt.Sprintf("syncer-%s", fileSyncer.ID()),
fmt.Sprintf("syncer-%s", fileSyncer.ID()[:8]),
0,
globalConfig.GetHeartbeatInterval(),
); hb != nil {
@@ -1306,7 +1306,7 @@ func startServer(ctx context.Context, serverName string, arguments *serverArgs)
// Start heartbeat reporter to admin server
if hb := startHeartbeat(
common.ServerTypeAPI,
fmt.Sprintf("ragflow-server-%d", apiServerConfig.HTTPPort),
fmt.Sprintf("ragflow-server-%s", utility.GenerateUUID()[:8]),
apiServerConfig.HTTPPort,
globalConfig.GetHeartbeatInterval(),
); hb != nil {
+14 -11
View File
@@ -901,8 +901,8 @@ func (s *Service) ListServices(ctx context.Context) ([]ServiceStatus, error) {
// compatibility with the shared service_conf.yaml.template; both map to
// the same Kvrocks backend, so probe the same connection.
case "redis", "kvrocks":
mysqlStatus := s.getRedisInfo(ctx)
results = append(results, mysqlStatus)
kvrocksStatus := s.getKvrocksStatus(ctx)
results = append(results, kvrocksStatus)
default:
redisConfig := globalConfig.GetKvrocksConfig()
results = append(results, newServiceStatus("cache", cacheType, redisConfig.Host, redisConfig.Port, "not available", time.Now(), "not supported cache type"))
@@ -911,6 +911,9 @@ func (s *Service) ListServices(ctx context.Context) ([]ServiceStatus, error) {
// message queue
messageQueueImpl := engine.GetMessageQueueEngine()
messageQueueStatus := messageQueueImpl.CheckStatus()
if messageQueueStatus == "CONNECTED" {
messageQueueStatus = "alive"
}
natsConfig := globalConfig.GetNATSConfig()
results = append(results, newServiceStatus("message_queue", messageQueueImpl.Type(), natsConfig.Host, natsConfig.Port, messageQueueStatus, time.Now(), ""))
@@ -948,7 +951,7 @@ func (s *Service) GetServiceDetails(configDict map[string]interface{}) ([]Servic
//case "meta_data":
// return s.getMySQLStatus(ctx), nil
//case "cache":
// return s.getRedisInfo(ctx), nil
// return s.getKvrocksStatus(ctx), nil
//case "message_queue":
// host := configDict["host"].(string)
// port := configDict["port"].(int)
@@ -1001,21 +1004,21 @@ func (s *Service) getMySQLStatus(ctx context.Context) ServiceStatus {
return newServiceStatus(serviceType, name, mysqlConfig.Host, mysqlConfig.Port, "alive", startTime, "")
}
// getRedisInfo gets Redis service info
func (s *Service) getRedisInfo(ctx context.Context) ServiceStatus {
// getKvrocksStatus gets the Kvrocks service status.
func (s *Service) getKvrocksStatus(ctx context.Context) ServiceStatus {
serviceType := "cache"
name := "redis"
name := "kvrocks"
startTime := time.Now()
redisConfig := server.GetConfig().GetKvrocksConfig()
kvrocksConfig := server.GetConfig().GetKvrocksConfig()
redisClient := kvrocks.Get()
if redisClient.Health(ctx) {
return newServiceStatus(serviceType, name, redisConfig.Host, redisConfig.Port, "alive", startTime, "")
kvrocksClient := kvrocks.Get()
if kvrocksClient.Health(ctx) {
return newServiceStatus(serviceType, name, kvrocksConfig.Host, kvrocksConfig.Port, "alive", startTime, "")
}
return newServiceStatus(serviceType, name, redisConfig.Host, redisConfig.Port, "timeout", startTime, "Redis health check failed")
return newServiceStatus(serviceType, name, kvrocksConfig.Host, kvrocksConfig.Port, "timeout", startTime, "Kvrocks health check failed")
}
// getESClusterStats gets Elasticsearch cluster stats
+4 -8
View File
@@ -115,9 +115,6 @@ function AdminServiceStatus() {
const columnDefs = useMemo(
() => [
columnHelper.accessor('id', {
header: t('admin.id'),
}),
columnHelper.accessor('name', {
header: t('admin.name'),
}),
@@ -304,13 +301,12 @@ function AdminServiceStatus() {
<CardContent>
<Table>
<colgroup>
<col className="w-[6%]" />
<col />
<col className="w-[22%]" />
<col className="w-[13%]" />
<col className="w-[22%]" />
<col className="w-[19%]" />
<col className="w-[10%]" />
<col className="w-[10%]" />
<col className="w-52" />
<col className="w-[15%]" />
<col className="w-[12%]" />
</colgroup>
<TableHeader>