mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 16:57:39 -05:00
Fixed the Mongoos schema for Stats
This commit is contained in:
@@ -69,13 +69,13 @@ exports.listSystems = async function (req, res, next) {
|
||||
const stats = await SystemStat.find({ shortName: { $in: shortNames } }).exec();
|
||||
var sys_stats = {}
|
||||
for (var i = 0; i < stats.length; i++) {
|
||||
sys_stats[stats[i].shortName] = {};
|
||||
|
||||
sys_stats[stats[i].shortName]["uploadErrors"] = stats[i].uploadErrors;
|
||||
sys_stats[stats[i].shortName]["callTotals"] = stats[i].callTotals;
|
||||
|
||||
sys_stats[stats[i].shortName].talkgroupStats= stats[i].talkgroupStats;
|
||||
sys_stats[stats[i].shortName].decodeErrorsFreq = stats[i].decodeErrorsFreq;
|
||||
console.log(stats[i])
|
||||
sys_stats[stats[i].shortName] = {
|
||||
uploadErrors: stats[i].uploadErrors,
|
||||
callTotals: stats[i].callTotals,
|
||||
talkgroupStats: stats[i].talkgroupStats,
|
||||
decodeErrorsFreq: stats[i].decodeErrorsFreq
|
||||
};
|
||||
}
|
||||
|
||||
console.log(sys_stats["test"]);
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
var mongoose = require('mongoose');
|
||||
|
||||
|
||||
|
||||
let decodeErrorSchema = mongoose.Schema({
|
||||
errorHistory: [Number],
|
||||
spikeHistory: [Number],
|
||||
})
|
||||
|
||||
let talkgroupStatsSchema = mongoose.Schema({
|
||||
callCountHistory: [Number],
|
||||
callAvgLenHistory: [Number]
|
||||
})
|
||||
var systemStatSchema = mongoose.Schema({
|
||||
callTotals: [Number],
|
||||
errorTotals: [Number],
|
||||
usageBytes: Number,
|
||||
usageMb: Number,
|
||||
uploadErrors: [Number],
|
||||
decodeErrorsFreq: {
|
||||
type: Map,
|
||||
of: decodeErrorSchema
|
||||
},
|
||||
talkgroupStats: {
|
||||
type: Map,
|
||||
of: talkgroupStatsSchema
|
||||
},
|
||||
shortName: String
|
||||
}, { collection: 'system_stats' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user