mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-20 12:46:01 -05:00
less messages, more meaning
This commit is contained in:
@@ -144,7 +144,7 @@ async function load_systems(systemClients) {
|
|||||||
}
|
}
|
||||||
// don't update the systemList until we have all the data or else load_systems will be called multiple times
|
// don't update the systemList until we have all the data or else load_systems will be called multiple times
|
||||||
systemList = tempList;
|
systemList = tempList;
|
||||||
console.log("Loaded Systems: " + systemList.length + " that have been active since: " + fromDate);
|
// console.log("Loaded Systems: " + systemList.length + " that have been active since: " + fromDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,10 @@ exports.upload = async function (req, res, next) {
|
|||||||
message: error.message,
|
message: error.message,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
const totalTime = Date.now() - start_time;
|
||||||
|
if (totalTime > 1000) {
|
||||||
|
console.warn(`[${req.params.shortName}] Slow Upload - Size: ${call.len} \t Verify System: ${validateSystemTime - start_time} \t Read file: ${readFileTime - validateSystemTime} \t Upload: ${ uploadFileTime - validateSystemTime} \t Save: ${saveCallTime - uploadFileTime} \tStats: ${statsTime - saveCallTime}\tCleanup: ${cleanupTime - statsTime} \t\t Total: ${totalTime}`);
|
||||||
|
}
|
||||||
span.end();
|
span.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ async function updateActiveSystems() {
|
|||||||
// Save talkgroupStats to a JSON file
|
// Save talkgroupStats to a JSON file
|
||||||
const filePath = "/data/stats/uploadsPerMin.json";
|
const filePath = "/data/stats/uploadsPerMin.json";
|
||||||
fs.writeFileSync(filePath, JSON.stringify(uploadsPerMin));
|
fs.writeFileSync(filePath, JSON.stringify(uploadsPerMin));
|
||||||
console.log("Saved uploadsPerMin to JSON file");
|
// console.log("Saved uploadsPerMin to JSON file");
|
||||||
console.log("Site average uploads per minute: " + siteTotal / timePeriod);
|
// console.log("Site average uploads per minute: " + siteTotal / timePeriod);
|
||||||
console.log("Active Systems: " + activeSystems);
|
// console.log("Active Systems: " + activeSystems);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.initStats = async function () {
|
exports.initStats = async function () {
|
||||||
@@ -102,7 +102,7 @@ exports.initStats = async function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for await (const item of SystemStat.find()) {
|
for await (const item of SystemStat.find()) {
|
||||||
const obj = item.toObject();
|
const obj = item.toObject();
|
||||||
// Talkgroup Stats
|
// Talkgroup Stats
|
||||||
@@ -129,7 +129,7 @@ exports.initStats = async function () {
|
|||||||
|
|
||||||
// keeps track of the number of calls that get uploaded with an audio file
|
// keeps track of the number of calls that get uploaded with an audio file
|
||||||
exports.addError = function (call) {
|
exports.addError = function (call) {
|
||||||
/*
|
/*
|
||||||
// if there is no Array associated with the system.
|
// if there is no Array associated with the system.
|
||||||
if (uploadErrors[call.shortName] === undefined) {
|
if (uploadErrors[call.shortName] === undefined) {
|
||||||
uploadErrors[call.shortName] = new Array();
|
uploadErrors[call.shortName] = new Array();
|
||||||
@@ -205,14 +205,14 @@ exports.shiftStats = async function () {
|
|||||||
// Save decodeErrorsFreq to a JSON file
|
// Save decodeErrorsFreq to a JSON file
|
||||||
const decodeErrorsFreqPath = "/data/stats/decodeErrorsFreq.json";
|
const decodeErrorsFreqPath = "/data/stats/decodeErrorsFreq.json";
|
||||||
fs.writeFileSync(decodeErrorsFreqPath, JSON.stringify(decodeErrorsFreq));
|
fs.writeFileSync(decodeErrorsFreqPath, JSON.stringify(decodeErrorsFreq));
|
||||||
console.log("Saved decodeErrorsFreq to JSON file");
|
//console.log("Saved decodeErrorsFreq to JSON file");
|
||||||
|
|
||||||
// Save talkgroupStats to a JSON file
|
// Save talkgroupStats to a JSON file
|
||||||
const filePath = "/data/stats/talkgroups.json";
|
const filePath = "/data/stats/talkgroups.json";
|
||||||
fs.writeFileSync(filePath, JSON.stringify(talkgroupStats));
|
fs.writeFileSync(filePath, JSON.stringify(talkgroupStats));
|
||||||
console.log("Saved talkgroupStats to JSON file");
|
//console.log("Saved talkgroupStats to JSON file");
|
||||||
|
|
||||||
console.log("Started Shifting Stats at: " + new Date());
|
//console.log("Started Shifting Stats at: " + new Date());
|
||||||
// for all the systems in Error Stats
|
// for all the systems in Error Stats
|
||||||
for (var shortName in uploadErrors) {
|
for (var shortName in uploadErrors) {
|
||||||
if (uploadErrors.hasOwnProperty(shortName)) {
|
if (uploadErrors.hasOwnProperty(shortName)) {
|
||||||
@@ -231,7 +231,7 @@ exports.shiftStats = async function () {
|
|||||||
uploadErrors[shortName][0] = 0;
|
uploadErrors[shortName][0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Finished Shifting Upload Errors at: " + new Date());
|
//console.log("Finished Shifting Upload Errors at: " + new Date());
|
||||||
|
|
||||||
// for each system in decodeErrorsFreq
|
// for each system in decodeErrorsFreq
|
||||||
for (let shortName in decodeErrorsFreq) {
|
for (let shortName in decodeErrorsFreq) {
|
||||||
@@ -280,7 +280,7 @@ exports.shiftStats = async function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Finished Shifting Decode Errors at: " + new Date());
|
//console.log("Finished Shifting Decode Errors at: " + new Date());
|
||||||
|
|
||||||
// for each system in talkgroupStats
|
// for each system in talkgroupStats
|
||||||
for (let shortName in talkgroupStats) {
|
for (let shortName in talkgroupStats) {
|
||||||
@@ -350,14 +350,14 @@ exports.shiftStats = async function () {
|
|||||||
await SystemStat.updateOne(query, update, options);*/
|
await SystemStat.updateOne(query, update, options);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Finished Shifting Talkgroup Stats at: " + new Date());
|
//console.log("Finished Shifting Talkgroup Stats at: " + new Date());
|
||||||
updateActiveSystems();
|
updateActiveSystems();
|
||||||
console.log("Finished Updating Active Systems at: " + new Date());
|
//console.log("Finished Updating Active Systems at: " + new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.siteStats = function(req, res) {
|
exports.siteStats = function (req, res) {
|
||||||
const siteStats ={
|
const siteStats = {
|
||||||
uploadsPerMin,
|
uploadsPerMin,
|
||||||
activeSystems,
|
activeSystems,
|
||||||
totalClients: req.totalClients
|
totalClients: req.totalClients
|
||||||
|
|||||||
Reference in New Issue
Block a user