Slightly more efficient circuit_queues page, and fix the issue with tin data not appearing.

This commit is contained in:
Herbert Wolverson
2023-03-15 14:25:58 +00:00
parent 70b4230339
commit d58c1cb459
3 changed files with 31 additions and 14 deletions

View File

@@ -194,6 +194,7 @@
<div class="card bg-light">
<div class="card-body">
<h5 class="card-title"><i class="fa fa-bar-chart"></i> Flows (Last 30 Seconds)</h5>
<div id="packetButtons"></div>
<div id="flowList"></div>
</div>
</div>
@@ -245,10 +246,13 @@
});
if (params.id != null) {
// Name the circuit
$.get("/api/circuit_info/" + encodeURI(params.id), (data) => {
circuit_info = data;
$("#circuitName").text(redactText(circuit_info.name));
});
if (circuit_info == null) {
$.get("/api/circuit_info/" + encodeURI(params.id), (data) => {
circuit_info = data;
let capacity = scaleNumber(circuit_info.capacity[0]) + " / " + scaleNumber(circuit_info.capacity[1]);
$("#circuitName").text(redactText(circuit_info.name) + " " + capacity);
});
}
// Fill the raw button
$("#raw").html("<a class='btn btn-sm btn-info' href='/api/raw_queue_by_circuit/" + encodeURI(params.id) + "'><i class='fa fa-search'></i> Raw Data</a>");
@@ -385,8 +389,6 @@
Plotly.newPlot(graph, graph_data, { margin: { l:0,r:0,b:0,t:0,pad:4 }, yaxis: { automargin: true }, xaxis: {automargin: true} });
});
}
setTimeout(pollQueue, 1000);
}
let ips = [];
@@ -478,8 +480,6 @@
Plotly.newPlot(graph, graph_data, { margin: { l:0,r:0,b:0,t:0,pad:4 }, yaxis: { automargin: true, title: '# Samples' }, xaxis: {automargin: true, title: '% Utilization'} });
});
}
setTimeout(getThroughput, 1000);
}
let funnels = new MultiRingBuffer(300);
@@ -536,7 +536,6 @@
rtts[data[i][0]].plot("rtt" + data[i][0]);
}
});
setTimeout(plotFunnels, 1000);
}
function ecn(n) {
@@ -567,6 +566,8 @@
}
}
var madeButtons = false;
function getFlows() {
let ip_list = "";
let ip_btns = "";
@@ -575,10 +576,15 @@
ip_btns += "<a href='/ip_dump?ip=" + ips[i] + "' class='btn btn-info'>Packet Dump: " + ips[i] + "</a>"
}
ip_btns += "<br />";
if (!madeButtons) {
madeButtons = true;
$("#packetButtons").html(ip_btns);
}
ip_list = ip_list.substring(0, ip_list.length-1);
if (ip_list == "") return;
$.get("/api/flows/" + ip_list, (data) => {
//console.log(data);
let html = ip_btns + "<table class='table table-striped'>";
let html = "<table class='table table-striped'>";
html += "<thead>";
html += "<th>Protocol</th>";
html += "<th>Src</th>";
@@ -636,7 +642,16 @@
html += "</tbody></table>";
$("#flowList").html(html);
})
setTimeout(getFlows, 1000);
}
let id = 0;
function oneSecondCadence() {
pollQueue();
getThroughput();
getFunnel(id);
getFlows();
setTimeout(oneSecondCadence, 1000);
}
function start() {
@@ -645,7 +660,9 @@
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
id = params.id;
$.get("/api/watch_circuit/" + params.id, () => {
oneSecondCadence();
pollQueue();
getThroughput();
getFunnel(params.id);

View File

@@ -18,7 +18,7 @@ fn track_queues() {
}
let config = LibreQoSConfig::load();
if config.is_err() {
warn!("Unable to read LibreQoS config. Skipping queue collection cycle.");
//warn!("Unable to read LibreQoS config. Skipping queue collection cycle.");
return;
}
let config = config.unwrap();
@@ -49,7 +49,7 @@ fn track_queues() {
if let Ok(download) = download {
if let Ok(upload) = upload {
if let Some(mut circuit) = CIRCUIT_TO_QUEUE.get_mut(circuit_id) {
if !download.is_empty() && upload.is_empty() {
if !download.is_empty() && !upload.is_empty() {
circuit.update(&download[0], &upload[0]);
}
} else {

View File

@@ -60,7 +60,7 @@ pub fn add_watched_queue(circuit_id: &str) {
};
WATCHED_QUEUES.insert(circuit.circuit_id.as_ref().unwrap().clone(), new_watch);
//info!("Added {circuit_id} to watched queues. Now watching {} queues.", WATCHED_QUEUES.read().len());
//info!("Added {circuit_id} to watched queues. Now watching {} queues.", WATCHED_QUEUES.len());
} else {
warn!("No circuit ID of {circuit_id}");
}