Add "Delay" column to Query Log

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-10-15 12:31:32 +02:00
parent 25cef3fbf4
commit d8a1469322
2 changed files with 25 additions and 8 deletions

View File

@@ -208,6 +208,24 @@ function parseQueryStatus(data) {
};
}
function formatReplyTime(data, type) {
const replyTime = data.reply.time;
if (type === "display") {
// Units:
// - seconds if replytime >= 1 second
// - milliseconds if reply time >= 100 µs
// - microseconds otherwise
return replyTime < 1e-4
? (1e6 * replyTime).toFixed(1) + " µs"
: replyTime < 1
? (1e3 * replyTime).toFixed(1) + " ms"
: replyTime.toFixed(1) + " s";
}
// else: return the number itself (for sorting and searching)
return replyTime;
}
function formatInfo(data) {
// DNSSEC status
var dnssecStatus = data.dnssec,
@@ -306,11 +324,7 @@ function formatInfo(data) {
if (data.reply.type !== "UNKNOWN") {
replyInfo = divStart + "Reply:&nbsp&nbsp;" + data.reply.type;
if (data.reply.time >= 0 && data.reply.type !== "UNKNOWN") {
replyInfo +=
" (" +
(data.reply.time < 1
? (1e3 * data.reply.time).toFixed(1) + " ms)"
: data.reply.time.toFixed(1) + " s)");
replyInfo += " (" + formatReplyTime(data, "display") + ")";
}
replyInfo += "</div>";
@@ -515,9 +529,10 @@ $(function () {
},
},
{ data: "status", width: "1%" },
{ data: "type", width: "5%" },
{ data: "type", width: "1%" },
{ data: "domain", width: "45%" },
{ data: "client.ip", width: "29%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ data: "client.ip", width: "29%", type: "ip-address" },
{ data: null, width: "4%", render: formatReplyTime },
{ data: null, width: "10%", sortable: false, searchable: false },
],
lengthMenu: [
@@ -569,7 +584,7 @@ $(function () {
}
if (querystatus.buttontext !== false) {
$("td:eq(5)", row).html(querystatus.buttontext);
$("td:eq(6)", row).html(querystatus.buttontext);
}
},
});