feat: observe BI data source health

This commit is contained in:
kkfluous
2026-08-07 16:05:20 +08:00
parent 02d714175f
commit 52c785f6ec
10 changed files with 182 additions and 20 deletions
+6 -6
View File
@@ -389,7 +389,7 @@ app.get('/hydrogen/overview', async (c) => {
}));
return { kpi, top5, regions, monthly, customers, stations, availableYears, year };
}, { force });
}, { force, source: 'hydrogenDatabase' });
return c.json(data);
});
@@ -530,7 +530,7 @@ app.get('/hydrogen/daily', async (c) => {
// 按日期降序返回
const result = ascDays.slice().sort((a, b) => b.date.localeCompare(a.date));
return result;
}, { force });
}, { force, source: 'hydrogenDatabase' });
return c.json(data);
});
@@ -615,7 +615,7 @@ app.get('/electric/overview', async (c) => {
trend: trendArr,
latestRecordAt,
};
}, { force });
}, { force, source: 'electricDatabase' });
return c.json(data);
});
@@ -688,7 +688,7 @@ app.get('/electric/orders', async (c) => {
totalFee: Math.round((Number(row.totalFee) || 0) * 100) / 100,
})),
};
});
}, { source: 'electricDatabase' });
return c.json(data);
});
@@ -779,7 +779,7 @@ app.get('/electric/monthly', async (c) => {
});
return months;
}, { force });
}, { force, source: 'electricDatabase' });
return c.json(data);
});
@@ -862,7 +862,7 @@ app.get('/etc/overview', async (c) => {
latestTransactionTime: record.latestTransactionTime ? String(record.latestTransactionTime) : null,
},
} as const;
}, { force });
}, { force, source: 'etcDatabase' });
return c.json(data);
});