add pixelstore stats to admin page
This commit is contained in:
@@ -181,17 +181,14 @@ function getStats(order) {
|
|||||||
fetch(apiEndpoint+"/status").then(
|
fetch(apiEndpoint+"/status").then(
|
||||||
resp => resp.json()
|
resp => resp.json()
|
||||||
).then(resp => {
|
).then(resp => {
|
||||||
let t = document.getElementById("tstat_body")
|
|
||||||
t.innerHTML = ""
|
|
||||||
let c = document.getElementById("tconnstat_body")
|
|
||||||
c.innerHTML = ""
|
|
||||||
|
|
||||||
document.getElementById("file_stats_watchers").innerText = resp.stats_watcher_threads;
|
document.getElementById("file_stats_watchers").innerText = resp.stats_watcher_threads;
|
||||||
document.getElementById("file_stats_listeners").innerText = resp.stats_watcher_listeners;
|
document.getElementById("file_stats_listeners").innerText = resp.stats_watcher_listeners;
|
||||||
document.getElementById("file_stats_avg").innerText = (
|
document.getElementById("file_stats_avg").innerText = (
|
||||||
resp.stats_watcher_listeners / resp.stats_watcher_threads
|
resp.stats_watcher_listeners / resp.stats_watcher_threads
|
||||||
).toPrecision(3);
|
).toPrecision(3);
|
||||||
|
|
||||||
|
let c = document.getElementById("tconnstat_body")
|
||||||
|
c.innerHTML = ""
|
||||||
resp.db_connection_stats.forEach(v => {
|
resp.db_connection_stats.forEach(v => {
|
||||||
let row = document.createElement("tr")
|
let row = document.createElement("tr")
|
||||||
row.innerHTML = `\
|
row.innerHTML = `\
|
||||||
@@ -204,6 +201,21 @@ function getStats(order) {
|
|||||||
c.appendChild(row)
|
c.appendChild(row)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let p = document.getElementById("tbody_peers")
|
||||||
|
p.innerHTML = ""
|
||||||
|
resp.peers.forEach(v => {
|
||||||
|
let row = document.createElement("tr")
|
||||||
|
row.innerHTML = `\
|
||||||
|
<td>${v.address}</td>
|
||||||
|
<td>${v.position}</td>
|
||||||
|
<td>${v.reachable}</td>
|
||||||
|
<td>${v.unreachable_count}</td>
|
||||||
|
<td>${formatDuration(v.latency)}</td>
|
||||||
|
<td>${formatDataVolume(v.free_space, 3)}</td>
|
||||||
|
<td>${formatDataVolume(v.min_free_space, 3)}</td>`
|
||||||
|
p.appendChild(row)
|
||||||
|
})
|
||||||
|
|
||||||
resp.query_statistics.sort((a, b) => {
|
resp.query_statistics.sort((a, b) => {
|
||||||
if (typeof(a[order]) === "number") {
|
if (typeof(a[order]) === "number") {
|
||||||
// Sort ints from high to low
|
// Sort ints from high to low
|
||||||
@@ -214,6 +226,8 @@ function getStats(order) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let t = document.getElementById("tstat_body")
|
||||||
|
t.innerHTML = ""
|
||||||
resp.query_statistics.forEach((v) => {
|
resp.query_statistics.forEach((v) => {
|
||||||
let callers = ""
|
let callers = ""
|
||||||
v.callers.sort((a, b) => b.count - a.count)
|
v.callers.sort((a, b) => b.count - a.count)
|
||||||
|
@@ -58,6 +58,21 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="tconnstat_body"></tbody>
|
<tbody id="tconnstat_body"></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<h3>Pixelstore peers</h3>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Address</td>
|
||||||
|
<td>Pos.</td>
|
||||||
|
<td>Reachable</td>
|
||||||
|
<td>Err count</td>
|
||||||
|
<td>Latency</td>
|
||||||
|
<td>Free space</td>
|
||||||
|
<td>Min free space</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_peers"></tbody>
|
||||||
|
</table>
|
||||||
<h3>Websocket statistics</h3>
|
<h3>Websocket statistics</h3>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
Reference in New Issue
Block a user