fix(web-probe): keep analyzer tail parser self contained (#745)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-23 18:16:07 +08:00
committed by GitHub
parent b4d4882631
commit da1e9ca4fa
@@ -2023,7 +2023,7 @@ import { createInterface } from "node:readline";
const stateDir = path.resolve(process.env.UNIDESK_WEB_OBSERVE_STATE_DIR || process.argv[2] || ".state/web-observe/manual");
const archivePrefix = safeArchivePrefix(process.env.UNIDESK_WEB_OBSERVE_ANALYZE_ARCHIVE_PREFIX || "");
const analyzeTailSamples = positiveInteger(process.env.UNIDESK_WEB_OBSERVE_ANALYZE_TAIL_SAMPLES, 360);
const analyzeTailSamples = (() => { const parsed = Number(process.env.UNIDESK_WEB_OBSERVE_ANALYZE_TAIL_SAMPLES); return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 360; })();
const alertThresholds = parseAlertThresholds(process.env.UNIDESK_WEB_OBSERVE_ALERT_THRESHOLDS_JSON);
const dataDir = archivePrefix ? path.join(stateDir, "archive") : stateDir;
const dataFile = (name) => path.join(dataDir, archivePrefix ? archivePrefix + "-" + name : name);