Compare commits

..

No commits in common. "07d281a56b9154285b9efc1714f6bb5dbd43fe28" and "ebcf6a1c6200dbd90f0d30dfffb54c48416aa2c0" have entirely different histories.

4 changed files with 10 additions and 48 deletions

View File

@ -75,7 +75,6 @@ async function query(collection, query){
var qcursor = qcoll.find(query) var qcursor = qcoll.find(query)
qcursor.project({_id: 0}) qcursor.project({_id: 0})
log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`) log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`)
increment(collection)
return (await qcursor.toArray()); return (await qcursor.toArray());
} }
@ -99,15 +98,15 @@ async function increment(target) {
let col = db.collection("meta"); let col = db.collection("meta");
let update = {} let update = {}
update[target] = 1 update[target] = 1
col.updateOne({target: "counters"}, {$inc:update}) col.updateOne({target: "ext_api"}, {$inc:update})
return; return;
} }
async function createCount() { async function createCount() {
await client.connect(); await client.connect();
let col = db.collection("meta"); let col = db.collection("meta");
var filter = {type: "count", target: "counters"}; var filter = {type: "count", target: "ext_api"};
var update = {$set:{since: new Date, type: "count", target: "counters"}}; var update = {$set:{since: new Date, type: "count", target: "ext_api"}};
var options = {upsert: true}; // If document isn't present will insert. var options = {upsert: true}; // If document isn't present will insert.
try { try {
var result = await col.updateOne(filter,update,options) var result = await col.updateOne(filter,update,options)

View File

@ -15,7 +15,7 @@ async function getCorpus(){
} }
async function hits(){ async function hits(){
var dat = await db.query("meta", {target: "counters"}); var dat = await db.query("meta", {target: "ext_api"});
log.out(`listServices.meta: fetched server meta`) log.out(`listServices.meta: fetched server meta`)
let out = {} let out = {}
out.host = os.hostname() out.host = os.hostname()

View File

@ -14,11 +14,7 @@ async function display(data) {
document.getElementById('server_host').textContent = `HOST: ${data.host}`; document.getElementById('server_host').textContent = `HOST: ${data.host}`;
let dat = data.dat[0] let dat = data.dat[0]
console.log(JSON.stringify(dat)) console.log(JSON.stringify(dat))
document.getElementById('time').textContent = dat.since; document.getElementById('time').textContent = `COUNTER START TIME: ${dat.since}`;
document.getElementById('ldbws').textContent = dat.ldbws || "0"; document.getElementById('ldbws').textContent = dat.ldbws || "0";
document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0"; document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0";
document.getElementById('corpus').textContent = dat.corpus || "0";
document.getElementById('stations').textContent = dat.stations || "0";
document.getElementById('users').textContent = dat.user || "0";
document.getElementById('meta').textContent = dat.meta || "0";
} }

View File

@ -4,48 +4,15 @@
<title>OwlBoard - STATS</title> <title>OwlBoard - STATS</title>
<script src="./js/stat.js"></script> <script src="./js/stat.js"></script>
</head> </head>
<body style="text-align:center"> <body>
<h1>OwlBoard Server Stats</h1> <h1>OwlBoard Server Stats</h1>
<h2 id="server_host"></h2> <h2 id="server_host"></h2>
<p>Counters Reset - <span id="time"></span></p> <p id="time"></p>
<table style="margin:auto;text-align:center;">
<tr>
<th>Resource</th>
<th>Hit Count</th>
</tr>
<tr>
<td>LDBWS</td>
<td id="ldbws"></td>
</tr>
<tr>
<td>LDBSVWS</td>
<td id="ldbsvws"></td>
</tr>
<tr>
<td>DB-CORPUS</td>
<td id="corpus"></td>
</tr>
<tr>
<td>DB-Stations</td>
<td id="stations"></td>
</tr>
<tr>
<td>DB-Users</td>
<td id="users"></td>
</tr>
<tr>
<td>DB-Meta</td>
<td id="meta"></td>
</tr>
</table>
<!--
<h3>LDBWS API Hits: <span id="ldbws"></span></h3> <h3>LDBWS API Hits: <span id="ldbws"></span></h3>
<h3>LDBSVWS API Hits: <span id="ldbsvws"></span></h3> <h3>LDBSVWS API Hits: <span id="ldbsvws"></span></h3>
<h3>CORPUS DB Lookups: <span id="corpus"></span></h3>
<h3>Station DB Lookups: <span id="stations"></span></h3>
<h3>User DB Queries: <span id="users"></span></h3> -->
<br><br> <br><br>
<p>The statistics represent hits & queries on all servers attached to the database. <p>Multiple servers can be attached to one database. All servers sharing this servers DB are represented in these statistics,
Multiple servers are served by each database server.</p> responses that do not lead to an upstream API hit are not counted.
</p>
</body> </body>
</html> </html>