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

View File

@ -15,7 +15,7 @@ async function getCorpus(){
}
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`)
let out = {}
out.host = os.hostname()

View File

@ -14,11 +14,7 @@ async function display(data) {
document.getElementById('server_host').textContent = `HOST: ${data.host}`;
let dat = data.dat[0]
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('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>
<script src="./js/stat.js"></script>
</head>
<body style="text-align:center">
<body>
<h1>OwlBoard Server Stats</h1>
<h2 id="server_host"></h2>
<p>Counters Reset - <span id="time"></span></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>
<!--
<p id="time"></p>
<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>The statistics represent hits & queries on all servers attached to the database.
Multiple servers are served by each database server.</p>
<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>
</body>
</html>