feat(system): expose model concurrency stats on runtime queues dashboard
Surface per-model active/waiting/limit from the background task limiter so admins can distinguish task scheduling from model-service throttling, with full i18n coverage.
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"github.com/Tencent/WeKnora/internal/database"
|
||||
"github.com/Tencent/WeKnora/internal/infrastructure/docparser"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
modellimiter "github.com/Tencent/WeKnora/internal/models/limiter"
|
||||
"github.com/Tencent/WeKnora/internal/runtime"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
@@ -1394,13 +1395,15 @@ type RuntimeWorkerPool struct {
|
||||
}
|
||||
|
||||
type RuntimeQueuesResponse struct {
|
||||
Available bool `json:"available"`
|
||||
UpstreamConcurrency int `json:"upstream_concurrency"`
|
||||
ParseConcurrency int `json:"parse_concurrency"` // compatibility alias for upstream_concurrency
|
||||
WikiConcurrency int `json:"wiki_concurrency"` // compatibility field
|
||||
Pools []RuntimeWorkerPool `json:"pools"`
|
||||
Queues []types.QueueStat `json:"queues"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Available bool `json:"available"`
|
||||
UpstreamConcurrency int `json:"upstream_concurrency"`
|
||||
ParseConcurrency int `json:"parse_concurrency"` // compatibility alias for upstream_concurrency
|
||||
WikiConcurrency int `json:"wiki_concurrency"` // compatibility field
|
||||
Pools []RuntimeWorkerPool `json:"pools"`
|
||||
Queues []types.QueueStat `json:"queues"`
|
||||
ModelLimiterAvailable bool `json:"model_limiter_available"`
|
||||
Models []modellimiter.RuntimeStat `json:"models"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// GetRuntimeQueues godoc
|
||||
@@ -1459,6 +1462,12 @@ func (h *SystemHandler) GetRuntimeQueues(c *gin.Context) {
|
||||
if resp.Queues == nil {
|
||||
resp.Queues = []types.QueueStat{}
|
||||
}
|
||||
modelStats, modelSupported, modelErr := modellimiter.RuntimeStats(ctx)
|
||||
if modelErr != nil {
|
||||
logger.Errorf(ctx, "get model concurrency stats failed: %v", modelErr)
|
||||
}
|
||||
resp.ModelLimiterAvailable = modelSupported
|
||||
resp.Models = modelStats
|
||||
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user