fix reload&refrehs

This commit is contained in:
larssand
2026-07-06 09:25:40 +02:00
parent fde165d79b
commit 1238fd0e4d
3 changed files with 31 additions and 9 deletions

View File

@@ -232,6 +232,8 @@ function mcpCapability(mcp, configuration, pollRunningSeconds=0) {
if (status === 'connected') return {state: 'on', detail: 'connected'};
if (status === 'partial') return {state: 'warn', detail: 'partial'};
if (status === 'refreshing') {
const pollBudget = Number(mcp.poll_timeout_seconds || configuration.graylog_mcp_poll_timeout_seconds || 120);
if (pollRunningSeconds > pollBudget) return {state: 'warn', detail: `poll over budget ${pollRunningSeconds}s`};
const previous = String(mcp.previous_status || '');
if (['connected', 'partial'].includes(previous) || Number(mcp.previous_events_fetched || mcp.events_fetched || 0) > 0 || Number(mcp.previous_aggregate_events || mcp.aggregate_events || 0) > 0) {
const suffix = pollRunningSeconds ? `polling ${pollRunningSeconds}s` : 'polling';
@@ -605,7 +607,7 @@ async function refresh() {
`MCP status: ${esc(mcp.status || 'unknown')}`,
mcp.status === 'refreshing' && pollStartedAt ? `MCP poll running: ${esc(pollRunningSeconds)}s` : '',
pollCompletedAt ? `Last completed MCP poll: ${esc(pollCompletedAge)}s ago` : '',
mcp.status === 'refreshing' && pollRunningSeconds > Math.max(120, Number(configuration.graylog_range_seconds || 300)) ? `<span class="sev-high">MCP poll has been refreshing for ${esc(pollRunningSeconds)}s. It may be slow or stuck.</span>` : '',
mcp.status === 'refreshing' && pollRunningSeconds > Number(mcp.poll_timeout_seconds || configuration.graylog_mcp_poll_timeout_seconds || 120) ? `<span class="sev-high">MCP poll has been refreshing for ${esc(pollRunningSeconds)}s, which is over the configured poll budget. Restart monitor or lower enabled streams/sample size if this keeps happening.</span>` : '',
mcp.error ? `<span class="sev-high">MCP error: ${esc(mcp.error)}</span>` : '',
`Enabled streams: ${esc(enabledStreams.length)}`,
`MCP fetch mode: ${esc(displayedFetchMode)}${mcp.status === 'refreshing' ? ' (refreshing, showing previous counters)' : ''}`,