core: add monitor/collect hook

This commit is contained in:
undefined committed 2024-02-29 10:06:14 +08:00
1 parent de5f46b980
commit 498cd57016
2 files changed
+2

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ export interface EventMap extends LifecycleEvents, HandlerEvents {
'system/setting': (args: Record<string, any>) => VoidReturn
'bus/broadcast': (event: keyof EventMap, ...args: any[]) => VoidReturn
'monitor/update': (type: 'server' | 'judge', $set: any) => VoidReturn
'monitor/collect': (info: any) => VoidReturn
'api/update': () => void;
'task/daily': () => void;
+1
View File
@@ -49,6 +49,7 @@ export async function feedback(): Promise<[string, StatusUpdate]> {
const status = await db.db.admin().serverStatus();
info.dbVersion = status.version;
} catch (e) { }
await bus.serial('monitor/collect', info);
const payload = dump(info, {
replacer: (key, value) => {
if (typeof value === 'function') return '';