fix: expose sentinel run timing in monitor
This commit is contained in:
@@ -619,6 +619,7 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId
|
||||
const latestRunCounts = {
|
||||
runId: latestRun?.id || latestRun?.runId || null,
|
||||
typeCount: numberValue(latestRun?.findingTypeCount ?? latestRun?.findingCount ?? latestRun?.finding_count),
|
||||
durationMinutes: numberValue(latestRun?.runDurationMinutes ?? latestRun?.durationMinutes ?? latestRun?.timing?.durationMinutes),
|
||||
error: 0,
|
||||
warning: 0,
|
||||
total: 0,
|
||||
@@ -661,6 +662,15 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId
|
||||
latestRunCounts.warning = latestDetailSummary.warningTypeCount;
|
||||
latestRunCounts.total = latestDetailSummary.alertTypeCount;
|
||||
latestRunCounts.all = latestDetailSummary.typeCount;
|
||||
const trendTooltipSummary = tooltipSummary(trendTooltip);
|
||||
const detailText = text(".pane-detail");
|
||||
const runListText = text(".run-list");
|
||||
const timingVisibility = {
|
||||
latestRunMinutes: latestRunCounts.durationMinutes,
|
||||
detailHasDuration: /运行分钟\s+[\d.]+\s*分钟/u.test(detailText),
|
||||
listHasDuration: /运行\s+[\d.]+\s*分钟/u.test(runListText),
|
||||
tooltipHasDuration: trendTooltipSummary.hasDuration,
|
||||
};
|
||||
const workspaceRect = workspace?.getBoundingClientRect();
|
||||
const checksRect = checksPanel?.getBoundingClientRect();
|
||||
const heightSummary = (rect) => {
|
||||
@@ -851,11 +861,12 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId
|
||||
badCardBodyCount: badCardBodies.length,
|
||||
trendCurve: Boolean(trend),
|
||||
trendDotCount: document.querySelectorAll(".trend-dot-hit").length,
|
||||
trendTooltip: tooltipSummary(trendTooltip),
|
||||
trendTooltip: trendTooltipSummary,
|
||||
trendPanelText: text("#trend-heading"),
|
||||
chartCounts,
|
||||
latestRunCounts,
|
||||
latestDetailSummary,
|
||||
timingVisibility,
|
||||
checkScope,
|
||||
selectedRunTags,
|
||||
trendPanelCompact,
|
||||
@@ -896,6 +907,7 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId
|
||||
text: body.slice(0, 240),
|
||||
hasValues: /错误\s+\d+/u.test(body) && /告警\s+\d+/u.test(body) && /合计\s+\d+/u.test(body),
|
||||
hasTime: /UTC/u.test(body) || /\d{4}-\d{2}-\d{2}/u.test(body),
|
||||
hasDuration: /运行\s+[\d.]+\s*分钟/u.test(body),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1059,7 +1071,9 @@ const ok = !navigationError
|
||||
&& dom.checkScope?.fullWidth === true
|
||||
&& dom.scopeLabels?.latestPointLegend === true
|
||||
&& dom.scopeLabels?.historicalSamples === true
|
||||
&& (dom.trendDotCount === 0 || (dom.trendTooltip?.visible === true && dom.trendTooltip?.hasValues === true && dom.trendTooltip?.hasTime === true))
|
||||
&& (dom.trendDotCount === 0 || (dom.trendTooltip?.visible === true && dom.trendTooltip?.hasValues === true && dom.trendTooltip?.hasTime === true && dom.trendTooltip?.hasDuration === true))
|
||||
&& dom.timingVisibility?.detailHasDuration === true
|
||||
&& dom.timingVisibility?.listHasDuration === true
|
||||
&& dom.trendPanelCompact?.ok === true
|
||||
&& (dom.checkScope?.expectsAlertRows !== true || (dom.checkRows > 0 && dom.checkDialog?.opened === true && dom.checkDialog?.large === true))
|
||||
&& dom.badCardTitleCount === 0
|
||||
@@ -1515,6 +1529,7 @@ function renderDashboardResult(result: Record<string, unknown>): string {
|
||||
const chartCounts = record(dom.chartCounts);
|
||||
const latestRunCounts = record(dom.latestRunCounts);
|
||||
const latestDetailSummary = record(dom.latestDetailSummary);
|
||||
const timingVisibility = record(dom.timingVisibility);
|
||||
const checkScope = record(dom.checkScope);
|
||||
const selectedRunTags = record(dom.selectedRunTags);
|
||||
const trendPanelCompact = record(dom.trendPanelCompact);
|
||||
@@ -1569,6 +1584,13 @@ function renderDashboardResult(result: Record<string, unknown>): string {
|
||||
overviewSamples.warning ?? "-",
|
||||
]]),
|
||||
"",
|
||||
table(["RUN_MIN", "DETAIL_MIN_VISIBLE", "LIST_MIN_VISIBLE", "TOOLTIP_MIN_VISIBLE"], [[
|
||||
latestRunCounts.durationMinutes ?? "-",
|
||||
timingVisibility.detailHasDuration ?? "-",
|
||||
timingVisibility.listHasDuration ?? "-",
|
||||
timingVisibility.tooltipHasDuration ?? "-",
|
||||
]]),
|
||||
"",
|
||||
table(["CHECK_SCOPE", "CHECK_RUN", "CHECK_TYPES", "CHECK_ERR_TYPES", "CHECK_ALERT_TYPES", "SAMPLE_ERR", "SAMPLE_ALERT", "CHECK_MATCH_LATEST", "CHECK_MATCH_DETAIL"], [[
|
||||
checkScope.scope ?? "-",
|
||||
checkScope.runId ?? "-",
|
||||
|
||||
Reference in New Issue
Block a user