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:
@@ -509,6 +509,14 @@ export interface RuntimeWorkerPool {
|
||||
queue_count: number
|
||||
}
|
||||
|
||||
export interface ModelRuntimeStat {
|
||||
model_id: string
|
||||
name: string
|
||||
active: number
|
||||
waiting: number
|
||||
limit: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime queue dashboard payload. `available` is false in Lite mode
|
||||
* (no Redis/asynq) — render an "unavailable in this deployment" state
|
||||
@@ -523,6 +531,8 @@ export interface RuntimeQueuesResponse {
|
||||
wiki_concurrency: number
|
||||
pools: RuntimeWorkerPool[]
|
||||
queues: QueueStat[]
|
||||
model_limiter_available: boolean
|
||||
models: ModelRuntimeStat[]
|
||||
timestamp: number
|
||||
}
|
||||
|
||||
|
||||
@@ -3506,6 +3506,16 @@ export default {
|
||||
attention: "Attention",
|
||||
paused: "Paused",
|
||||
},
|
||||
models: {
|
||||
title: "Model concurrency",
|
||||
description: "Actual model-service concurrency from background tasks. The section above schedules tasks; this section shows the separate model-service throttle stage.",
|
||||
scope: "Active is cluster-wide · waiting is local",
|
||||
disabled: "Background model concurrency governance is disabled. Configure the default model concurrency limit in Global settings.",
|
||||
empty: "No model activity yet. A model appears after its first background call.",
|
||||
backgroundOnly: "Background tasks only; interactive chat is excluded",
|
||||
columns: { model: "Model ID", active: "In flight", waiting: "Throttled", usage: "Concurrency" },
|
||||
status: { queued: "Throttling", full: "At limit" },
|
||||
},
|
||||
pools: {
|
||||
core: "Core parsing",
|
||||
enrichment: "Enrichment",
|
||||
|
||||
@@ -2511,6 +2511,16 @@ export default {
|
||||
attention: "확인 필요",
|
||||
paused: "일시중지됨",
|
||||
},
|
||||
models: {
|
||||
title: "모델 동시성",
|
||||
description: "백그라운드 작업이 실제로 모델 서비스에 진입할 때의 동시성입니다. 위 섹션은 작업 스케줄링이고, 이 섹션은 별도의 모델 서비스 스로틀 단계입니다.",
|
||||
scope: "실행 중은 클러스터 전체 · 대기는 로컬",
|
||||
disabled: "백그라운드 모델 동시성 제어가 비활성화되어 있습니다. 전역 설정에서 모델 기본 동시성 상한을 구성하세요.",
|
||||
empty: "아직 모델 활동이 없습니다. 첫 백그라운드 호출 후 모델이 표시됩니다.",
|
||||
backgroundOnly: "백그라운드 작업만; 대화형 채팅은 제외",
|
||||
columns: { model: "모델 ID", active: "실행 중", waiting: "스로틀 대기", usage: "동시성" },
|
||||
status: { queued: "스로틀 중", full: "한도 도달" },
|
||||
},
|
||||
pools: {
|
||||
core: "핵심 파싱",
|
||||
enrichment: "콘텐츠 보강",
|
||||
|
||||
@@ -2209,6 +2209,16 @@ export default {
|
||||
attention: "Требует внимания",
|
||||
paused: "Приостановлено",
|
||||
},
|
||||
models: {
|
||||
title: "Параллелизм моделей",
|
||||
description: "Фактический параллелизм вызовов модели из фоновых задач. Раздел выше планирует задачи; этот раздел показывает отдельный этап ограничения на стороне модели.",
|
||||
scope: "Активные — по всему кластеру · ожидающие — локально",
|
||||
disabled: "Управление фоновым параллелизмом моделей отключено. Настройте лимит по умолчанию в глобальных настройках.",
|
||||
empty: "Пока нет данных о вызовах моделей. Модель появится после первого фонового вызова.",
|
||||
backgroundOnly: "Только фоновые задачи; интерактивный чат не учитывается",
|
||||
columns: { model: "ID модели", active: "В работе", waiting: "Ожидание ограничения", usage: "Параллелизм" },
|
||||
status: { queued: "Ограничение", full: "На лимите" },
|
||||
},
|
||||
pools: {
|
||||
core: "Основной разбор",
|
||||
enrichment: "Обогащение",
|
||||
|
||||
@@ -2514,6 +2514,16 @@ export default {
|
||||
attention: "需关注",
|
||||
paused: "已暂停",
|
||||
},
|
||||
models: {
|
||||
title: "模型并发占用",
|
||||
description: "观察后台任务实际进入模型服务时的并发占用;上方是任务调度,这里是模型服务限流,两者处于不同处理阶段。",
|
||||
scope: "占用为集群全局 · 等待为当前实例",
|
||||
disabled: "模型后台并发治理未启用。可在全局设置中配置模型默认并发上限。",
|
||||
empty: "暂无模型调用数据;模型首次执行后台任务后会出现在这里。",
|
||||
backgroundOnly: "仅统计后台任务,不包含交互式对话",
|
||||
columns: { model: "模型 ID", active: "调用中", waiting: "限流等待", usage: "并发用量" },
|
||||
status: { queued: "限流中", full: "已满载" },
|
||||
},
|
||||
pools: {
|
||||
core: "核心解析",
|
||||
enrichment: "内容富化",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="!available" class="rq-state">
|
||||
<div v-else-if="!available && !modelLimiterAvailable" class="rq-state">
|
||||
<div class="rq-state-icon"><t-icon name="info-circle" size="24px" /></div>
|
||||
<div class="rq-state-copy">
|
||||
<strong>{{ t('system.globalSettings.runtime.unavailableTitle') }}</strong>
|
||||
@@ -68,6 +68,7 @@
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<template v-if="available">
|
||||
<section class="rq-overview" :aria-label="t('system.globalSettings.runtime.summary.title')">
|
||||
<div class="rq-overview-title">
|
||||
<span class="rq-overview-mark"><t-icon name="chart-line" /></span>
|
||||
@@ -181,6 +182,46 @@
|
||||
</t-table>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<section class="rq-details rq-models">
|
||||
<div class="rq-details-header">
|
||||
<div>
|
||||
<h3>{{ t('system.globalSettings.runtime.models.title') }}</h3>
|
||||
<p>{{ t('system.globalSettings.runtime.models.description') }}</p>
|
||||
</div>
|
||||
<span class="rq-pools-note">{{ t('system.globalSettings.runtime.models.scope') }}</span>
|
||||
</div>
|
||||
<div v-if="!modelLimiterAvailable" class="rq-empty">
|
||||
<t-icon name="info-circle" size="28px" />
|
||||
<span>{{ t('system.globalSettings.runtime.models.disabled') }}</span>
|
||||
</div>
|
||||
<div v-else-if="models.length === 0" class="rq-empty">
|
||||
<t-icon name="server" size="28px" />
|
||||
<span>{{ t('system.globalSettings.runtime.models.empty') }}</span>
|
||||
</div>
|
||||
<div v-else class="data-table-shell rq-table-shell">
|
||||
<t-table row-key="model_id" :data="models" :columns="modelColumns" size="medium" hover>
|
||||
<template #model_id="{ row }">
|
||||
<div class="rq-queue-cell">
|
||||
<span class="rq-queue-name">{{ row.name || row.model_id }}</span>
|
||||
<span class="rq-queue-meta">{{ row.name ? row.model_id : t('system.globalSettings.runtime.models.backgroundOnly') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #active="{ row }"><span class="rq-number" :class="{ 'rq-number--active': row.active > 0 }">{{ row.active }}</span></template>
|
||||
<template #waiting="{ row }"><span class="rq-number" :class="{ 'rq-number--warning': row.waiting > 0 }">{{ row.waiting }}</span></template>
|
||||
<template #usage="{ row }">
|
||||
<div class="rq-model-usage">
|
||||
<t-progress :percentage="modelUsage(row)" size="small" :label="false" />
|
||||
<span>{{ row.active }} / {{ row.limit }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<span class="rq-status" :class="`rq-status--${modelState(row).tone}`"><i />{{ modelState(row).label }}</span>
|
||||
</template>
|
||||
</t-table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<p class="rq-footnote">{{ t('system.globalSettings.runtime.footnote') }}</p>
|
||||
</template>
|
||||
@@ -190,7 +231,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getRuntimeQueues, type QueueStat, type RuntimeWorkerPool } from '@/api/system'
|
||||
import { getRuntimeQueues, type QueueStat, type RuntimeWorkerPool, type ModelRuntimeStat } from '@/api/system'
|
||||
|
||||
const { t, te, locale } = useI18n()
|
||||
|
||||
@@ -198,6 +239,8 @@ const POLL_INTERVAL_MS = 5000
|
||||
|
||||
const queues = ref<QueueStat[]>([])
|
||||
const pools = ref<RuntimeWorkerPool[]>([])
|
||||
const models = ref<ModelRuntimeStat[]>([])
|
||||
const modelLimiterAvailable = ref(false)
|
||||
const available = ref(true)
|
||||
const loading = ref(false)
|
||||
const loadedOnce = ref(false)
|
||||
@@ -216,6 +259,24 @@ const columns = computed(() => [
|
||||
{ colKey: 'latency_ms', title: t('system.globalSettings.runtime.columns.latency'), width: 104, align: 'right' as const },
|
||||
{ colKey: 'status', title: t('system.globalSettings.runtime.columns.status'), width: 96 },
|
||||
])
|
||||
const modelColumns = computed(() => [
|
||||
{ colKey: 'model_id', title: t('system.globalSettings.runtime.models.columns.model'), minWidth: 240 },
|
||||
{ colKey: 'active', title: t('system.globalSettings.runtime.models.columns.active'), width: 86, align: 'right' as const },
|
||||
{ colKey: 'waiting', title: t('system.globalSettings.runtime.models.columns.waiting'), width: 86, align: 'right' as const },
|
||||
{ colKey: 'usage', title: t('system.globalSettings.runtime.models.columns.usage'), width: 190 },
|
||||
{ colKey: 'status', title: t('system.globalSettings.runtime.columns.status'), width: 96 },
|
||||
])
|
||||
|
||||
function modelUsage(row: ModelRuntimeStat): number {
|
||||
return row.limit > 0 ? Math.min(100, Math.round(row.active / row.limit * 100)) : 0
|
||||
}
|
||||
|
||||
function modelState(row: ModelRuntimeStat): { label: string; tone: string } {
|
||||
if (row.waiting > 0) return { label: t('system.globalSettings.runtime.models.status.queued'), tone: 'attention' }
|
||||
if (row.active >= row.limit) return { label: t('system.globalSettings.runtime.models.status.full'), tone: 'waiting' }
|
||||
if (row.active > 0) return { label: t('system.globalSettings.runtime.status.working'), tone: 'working' }
|
||||
return { label: t('system.globalSettings.runtime.status.idle'), tone: 'idle' }
|
||||
}
|
||||
|
||||
const totalActive = computed(() => queues.value.reduce((s, q) => s + q.active, 0))
|
||||
const totalPending = computed(() => queues.value.reduce((s, q) => s + q.pending, 0))
|
||||
@@ -282,6 +343,8 @@ async function load(showSpinner: boolean) {
|
||||
available.value = resp.available
|
||||
pools.value = resp.pools || []
|
||||
queues.value = resp.queues || []
|
||||
models.value = resp.models || []
|
||||
modelLimiterAvailable.value = Boolean(resp.model_limiter_available)
|
||||
updatedAt.value = new Date((resp.timestamp || Date.now() / 1000) * 1000)
|
||||
.toLocaleTimeString(locale.value, { hour12: false })
|
||||
error.value = ''
|
||||
@@ -331,6 +394,21 @@ onUnmounted(() => stopPolling())
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
.rq-models {
|
||||
margin-top: 40px;
|
||||
padding-top: 32px;
|
||||
}
|
||||
|
||||
.rq-model-usage {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(72px, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rq-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
Reference in New Issue
Block a user