⏱️ feat: implement uptime monitoring

Introduce application uptime monitoring to improve observability and reliability.

• Add UptimeService to track process start time and expose uptime in seconds
• Create /health/uptime endpoint returning the current uptime in JSON format
• Integrate uptime metric into existing health-check middleware
• Update README with instructions for consuming the new endpoint
• Add unit tests covering UptimeService and new health route

This change enables operations teams and dashboards to programmatically
determine how long the service has been running, facilitating automated
alerts and trend analysis.
This commit is contained in:
Apple\Apple
2025-06-11 02:28:36 +08:00
parent 3f89ee66e1
commit 52356a1b92
10 changed files with 560 additions and 29 deletions

View File

@@ -218,7 +218,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
const newList = announcementsList.filter(item => item.id !== deletingAnnouncement.id);
setAnnouncementsList(newList);
setHasChanges(true);
showSuccess('公告已删除,请及时点击“保存置”进行保存');
showSuccess('公告已删除,请及时点击“保存置”进行保存');
}
setShowDeleteModal(false);
setDeletingAnnouncement(null);
@@ -258,7 +258,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
setAnnouncementsList(newList);
setHasChanges(true);
setShowAnnouncementModal(false);
showSuccess(editingAnnouncement ? '公告已更新,请及时点击“保存置”进行保存' : '公告已添加,请及时点击“保存置”进行保存');
showSuccess(editingAnnouncement ? '公告已更新,请及时点击“保存置”进行保存' : '公告已添加,请及时点击“保存置”进行保存');
} catch (error) {
showError('操作失败: ' + error.message);
} finally {
@@ -303,7 +303,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
setAnnouncementsList(newList);
setSelectedRowKeys([]);
setHasChanges(true);
showSuccess(`已删除 ${selectedRowKeys.length} 个系统公告,请及时点击“保存置”进行保存`);
showSuccess(`已删除 ${selectedRowKeys.length} 个系统公告,请及时点击“保存置”进行保存`);
};
const renderHeader = () => (
@@ -346,7 +346,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
type='secondary'
className="!rounded-full w-full md:w-auto"
>
{t('保存置')}
{t('保存置')}
</Button>
</div>
</div>