Bound dashboard page response sources
All checks were successful
deploy / deploy (push) Successful in 58s
All checks were successful
deploy / deploy (push) Successful in 58s
Proof: Production sampling found oversized strategy serialization and slow system probes; successful-trade details are capped at 50 and service probes are bounded with persisted fallback, with full tests and dashboard build passing. Assumptions: The initial service snapshot is a truthful last-successful fallback when optional probes exceed their page budget. Still fake: Pod-local PostgreSQL activity and production deployment evidence remain pending cluster access; exact all-time submission totals remain unavailable.
This commit is contained in:
parent
7aced9a98d
commit
5354673d7c
2 changed files with 28 additions and 2 deletions
|
|
@ -735,7 +735,7 @@ async function loadDashboardPage({ page, auth }) {
|
||||||
const runtimeConfig = buildRuntimeConfig(tradingConfig);
|
const runtimeConfig = buildRuntimeConfig(tradingConfig);
|
||||||
const generatedAt = new Date().toISOString();
|
const generatedAt = new Date().toISOString();
|
||||||
const load = (name, loader, fallback) => safeSourceLoad(name, loader, fallback, sourceErrors);
|
const load = (name, loader, fallback) => safeSourceLoad(name, loader, fallback, sourceErrors);
|
||||||
const serviceSnapshots = await load('service_snapshots', loadServiceSnapshots, []);
|
const serviceSnapshots = await load('service_snapshots', loadServiceSnapshotsBounded, initialServiceSnapshots);
|
||||||
|
|
||||||
if (page === 'funds') {
|
if (page === 'funds') {
|
||||||
const [portfolioMetric, inventorySnapshot, marketPrice, fundingObservations,
|
const [portfolioMetric, inventorySnapshot, marketPrice, fundingObservations,
|
||||||
|
|
@ -847,6 +847,30 @@ async function loadServiceSnapshots() {
|
||||||
return Promise.all(services.map((service) => loadServiceSnapshot(service)));
|
return Promise.all(services.map((service) => loadServiceSnapshot(service)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadServiceSnapshotsBounded() {
|
||||||
|
const timeoutMs = Math.min(2_500, Number(config.operatorDashboardUpstreamTimeoutMs) || 3_000);
|
||||||
|
let timeout;
|
||||||
|
try {
|
||||||
|
return await Promise.race([
|
||||||
|
loadServiceSnapshots(),
|
||||||
|
new Promise((_, reject) => {
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
const error = new Error(`service probes exceeded ${timeoutMs}ms`);
|
||||||
|
error.name = 'TimeoutError';
|
||||||
|
reject(error);
|
||||||
|
}, timeoutMs);
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn('dashboard_service_probe_budget_exceeded', {
|
||||||
|
details: { timeout_ms: timeoutMs, error: serializeError(error) },
|
||||||
|
});
|
||||||
|
return initialServiceSnapshots;
|
||||||
|
} finally {
|
||||||
|
if (timeout) clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function loadServiceSnapshot(service) {
|
async function loadServiceSnapshot(service) {
|
||||||
const [stateResult, healthResult] = await Promise.allSettled([
|
const [stateResult, healthResult] = await Promise.allSettled([
|
||||||
fetchUpstreamJson(`${service.base_url}/state`),
|
fetchUpstreamJson(`${service.base_url}/state`),
|
||||||
|
|
|
||||||
|
|
@ -1981,7 +1981,9 @@ function buildTradeFunnelSummary(lifecycleRows = []) {
|
||||||
successful_trade_gross_edge_estimate_count: grossEdgeEstimate.count,
|
successful_trade_gross_edge_estimate_count: grossEdgeEstimate.count,
|
||||||
unresolved_submission_count: unresolvedSubmissions.length,
|
unresolved_submission_count: unresolvedSubmissions.length,
|
||||||
no_trade_count: noTradeRows.length,
|
no_trade_count: noTradeRows.length,
|
||||||
successful_trades: successfulTrades,
|
// Keep the dashboard response bounded while retaining the full count and
|
||||||
|
// aggregate estimate from the bounded lifecycle input.
|
||||||
|
successful_trades: successfulTrades.slice(0, 50),
|
||||||
unresolved_submissions: unresolvedSubmissions.slice(0, 20),
|
unresolved_submissions: unresolvedSubmissions.slice(0, 20),
|
||||||
no_trade_rows: [],
|
no_trade_rows: [],
|
||||||
counts,
|
counts,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue