mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add monitor/collect hook
This commit is contained in:
2 files changed
+2
No files matched your search
@@ -47,6 +47,7 @@ export interface EventMap extends LifecycleEvents, HandlerEvents {
|
|||||||
'system/setting': (args: Record<string, any>) => VoidReturn
|
'system/setting': (args: Record<string, any>) => VoidReturn
|
||||||
'bus/broadcast': (event: keyof EventMap, ...args: any[]) => VoidReturn
|
'bus/broadcast': (event: keyof EventMap, ...args: any[]) => VoidReturn
|
||||||
'monitor/update': (type: 'server' | 'judge', $set: any) => VoidReturn
|
'monitor/update': (type: 'server' | 'judge', $set: any) => VoidReturn
|
||||||
|
'monitor/collect': (info: any) => VoidReturn
|
||||||
'api/update': () => void;
|
'api/update': () => void;
|
||||||
'task/daily': () => void;
|
'task/daily': () => void;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export async function feedback(): Promise<[string, StatusUpdate]> {
|
|||||||
const status = await db.db.admin().serverStatus();
|
const status = await db.db.admin().serverStatus();
|
||||||
info.dbVersion = status.version;
|
info.dbVersion = status.version;
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
|
await bus.serial('monitor/collect', info);
|
||||||
const payload = dump(info, {
|
const payload = dump(info, {
|
||||||
replacer: (key, value) => {
|
replacer: (key, value) => {
|
||||||
if (typeof value === 'function') return '';
|
if (typeof value === 'function') return '';
|
||||||
|
|||||||
Reference in new issue
Block a user