FullStack: Expand stats page
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
ebcf6a1c62
commit
be745978bb
@ -75,6 +75,7 @@ async function query(collection, query){
|
||||
var qcursor = qcoll.find(query)
|
||||
qcursor.project({_id: 0})
|
||||
log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`)
|
||||
increment(collection)
|
||||
return (await qcursor.toArray());
|
||||
}
|
||||
|
||||
@ -98,15 +99,15 @@ async function increment(target) {
|
||||
let col = db.collection("meta");
|
||||
let update = {}
|
||||
update[target] = 1
|
||||
col.updateOne({target: "ext_api"}, {$inc:update})
|
||||
col.updateOne({target: "counters"}, {$inc:update})
|
||||
return;
|
||||
}
|
||||
|
||||
async function createCount() {
|
||||
await client.connect();
|
||||
let col = db.collection("meta");
|
||||
var filter = {type: "count", target: "ext_api"};
|
||||
var update = {$set:{since: new Date, type: "count", target: "ext_api"}};
|
||||
var filter = {type: "count", target: "counters"};
|
||||
var update = {$set:{since: new Date, type: "count", target: "counters"}};
|
||||
var options = {upsert: true}; // If document isn't present will insert.
|
||||
try {
|
||||
var result = await col.updateOne(filter,update,options)
|
||||
|
@ -15,7 +15,7 @@ async function getCorpus(){
|
||||
}
|
||||
|
||||
async function hits(){
|
||||
var dat = await db.query("meta", {target: "ext_api"});
|
||||
var dat = await db.query("meta", {target: "counters"});
|
||||
log.out(`listServices.meta: fetched server meta`)
|
||||
let out = {}
|
||||
out.host = os.hostname()
|
||||
|
@ -17,4 +17,8 @@ async function display(data) {
|
||||
document.getElementById('time').textContent = `COUNTER START TIME: ${dat.since}`;
|
||||
document.getElementById('ldbws').textContent = dat.ldbws || "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";
|
||||
}
|
@ -8,11 +8,44 @@
|
||||
<h1>OwlBoard Server Stats</h1>
|
||||
<h2 id="server_host"></h2>
|
||||
<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>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>
|
||||
<p>Multiple servers can be attached to one database. All servers sharing this servers DB are represented in these statistics,
|
||||
responses that do not lead to an upstream API hit are not counted.
|
||||
</p>
|
||||
<p>The statistics represent hits & queries on all servers attached to the database.
|
||||
Multiple servers are served by each database server.</p>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user