mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +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
@@ -48,6 +48,7 @@ class DataReportHandler extends Handler {
|
||||
discussionCount: payload.discussionCount,
|
||||
recordCount: payload.recordCount,
|
||||
sandbox: payload.sandbox,
|
||||
dbVersion: payload.dbVersion,
|
||||
},
|
||||
}, { upsert: true });
|
||||
bus.emit('center/report', this, installId, old, payload);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/center",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -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