mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: telemetry: add dbVersion
This commit is contained in:
1 parent
b1b933f3d7
commit
01d9879ebf
3 files changed
+15
-11
No files matched your search
@@ -31,14 +31,7 @@ export async function feedback(): Promise<[string, StatusUpdate]> {
|
||||
document.coll.find({ docType: document.TYPE_DISCUSSION }).count(),
|
||||
record.coll.find().count(),
|
||||
]);
|
||||
let sandbox = '';
|
||||
try {
|
||||
let host = system.get('hydrojudge.sandbox_host') || 'http://localhost:5050/';
|
||||
if (!host.endsWith('/')) host += '/';
|
||||
const res = await superagent.get(`${host}version`);
|
||||
sandbox = res.body;
|
||||
} catch (e) { }
|
||||
const payload = crypt(dump({
|
||||
const info: Record<string, any> = {
|
||||
mid: mid.toString(),
|
||||
version,
|
||||
name,
|
||||
@@ -52,8 +45,18 @@ export async function feedback(): Promise<[string, StatusUpdate]> {
|
||||
memory: inf.memory,
|
||||
osinfo: inf.osinfo,
|
||||
cpu: inf.cpu,
|
||||
sandbox,
|
||||
}, {
|
||||
};
|
||||
try {
|
||||
let host = system.get('hydrojudge.sandbox_host') || 'http://localhost:5050/';
|
||||
if (!host.endsWith('/')) host += '/';
|
||||
const res = await superagent.get(`${host}version`);
|
||||
info.sandbox = res.body;
|
||||
} catch (e) { }
|
||||
try {
|
||||
const status = await db.db.admin().serverStatus();
|
||||
info.dbVersion = status.version;
|
||||
} catch (e) { }
|
||||
const payload = crypt(dump(info, {
|
||||
replacer: (key, value) => {
|
||||
if (typeof value === 'function') return '';
|
||||
return value;
|
||||
|
||||
Reference in new issue
Block a user