Skip to content
Snippets Groups Projects
Commit c847bb42 authored by David Schmitz's avatar David Schmitz
Browse files

fix/wrong_ratelimit_stats: update

parent d596e69f
No related branches found
No related tags found
No related merge requests found
...@@ -152,12 +152,12 @@ function plotGraph(route_then_action, data) ...@@ -152,12 +152,12 @@ function plotGraph(route_then_action, data)
var ybytesdata = Array(); var ybytesdata = Array();
var ybytesdatarel = Array(); var ybytesdatarel = Array();
var ydroppedpkgdata = Array(); var ymatchedpkgdata = Array();
var ydroppedpkgdatarel = Array(); var ymatchedpkgdatarel = Array();
var ydroppedbytesdata = Array(); var ymatchedbytesdata = Array();
var ydroppedbytesdatarel = Array(); var ymatchedbytesdatarel = Array();
var ydropped_available = false; var ymatched_available = false;
for (i=0; i<data["data"].length; i++) { for (i=0; i<data["data"].length; i++) {
var d = data["data"][data["data"].length - 1 - i]; var d = data["data"][data["data"].length - 1 - i];
...@@ -178,21 +178,29 @@ function plotGraph(route_then_action, data) ...@@ -178,21 +178,29 @@ function plotGraph(route_then_action, data)
ybytesdatarel[i] = (bytesdelta===undefined || bytesdelta>=0) ? bytesdelta : 0; ybytesdatarel[i] = (bytesdelta===undefined || bytesdelta>=0) ? bytesdelta : 0;
} }
if (d.value_dropped!=undefined) { if (d.value_matched!=undefined) {
ydropped_available=true ymatched_available=true
ymatched_packets = d.value_matched.packets;
ymatched_bytes = d.value_matched.bytes;
} else if (d.value_dropped!=undefined) { // support for ".value_dropped" which actually really effectively was matched bytes/packets (as having been wrongly used/named, and which was in use for a short time in 2024-02)
ymatched_available=true
ymatched_packets = d.value_dropped.packets;
ymatched_bytes = d.value_dropped.bytes;
}
ydroppedpkgdata[i] = d.value_dropped.packets; if (ymatched_available) {
ydroppedbytesdata[i] = d.value_dropped.bytes; ymatchedpkgdata[i] = ymatched_packets;
ymatchedbytesdata[i] = ymatched_bytes;
if (i == 0) { if (i == 0) {
ydroppedpkgdatarel[i] = 0; ymatchedpkgdatarel[i] = 0;
ydroppedbytesdatarel[i] = 0; ymatchedbytesdatarel[i] = 0;
} else { } else {
delta = (ydroppedpkgdata[i]===undefined) ? undefined : (ydroppedpkgdata[i-1]===undefined) ? ydroppedpkgdata[i] : (ydroppedpkgdata[i] - ydroppedpkgdata[i-1]); delta = (ymatchedpkgdata[i]===undefined) ? undefined : (ymatchedpkgdata[i-1]===undefined) ? ymatchedpkgdata[i] : (ymatchedpkgdata[i] - ymatchedpkgdata[i-1]);
ydroppedpkgdatarel[i] = (delta===undefined || delta>=0) ? delta : 0; ymatchedpkgdatarel[i] = (delta===undefined || delta>=0) ? delta : 0;
bytesdelta = (ydroppedbytesdata[i]===undefined) ? undefined : (ydroppedbytesdata[i-1]===undefined) ? ydroppedbytesdata[i] : (ydroppedbytesdata[i] - ydroppedbytesdata[i-1]); bytesdelta = (ymatchedbytesdata[i]===undefined) ? undefined : (ymatchedbytesdata[i-1]===undefined) ? ymatchedbytesdata[i] : (ymatchedbytesdata[i] - ymatchedbytesdata[i-1]);
ydroppedbytesdatarel[i] = (bytesdelta===undefined || bytesdelta>=0) ? bytesdelta : 0; ymatchedbytesdatarel[i] = (bytesdelta===undefined || bytesdelta>=0) ? bytesdelta : 0;
} }
...@@ -228,24 +236,24 @@ function plotGraph(route_then_action, data) ...@@ -228,24 +236,24 @@ function plotGraph(route_then_action, data)
if (is_drop_rule) { if (is_drop_rule) {
matched_text = "matched and dropped"; dropped_text = "matched and dropped";
value1__borderColor = drop__borderColor; value1__borderColor = drop__borderColor;
value1__pointbackgroundColor = drop__pointbackgroundColor; value1__pointbackgroundColor = drop__pointbackgroundColor;
value1__backgroundColor = drop__backgroundColor; value1__backgroundColor = drop__backgroundColor;
} else if (is_accept_rule) { } else if (is_accept_rule) {
matched_text = "matched and accepted"; dropped_text = "matched and accepted";
value1__borderColor = accept__borderColor; value1__borderColor = accept__borderColor;
value1__pointbackgroundColor = accept__pointbackgroundColor; value1__pointbackgroundColor = accept__pointbackgroundColor;
value1__backgroundColor = accept__backgroundColor; value1__backgroundColor = accept__backgroundColor;
} else { } else {
matched_text = "matched"; dropped_text = "dropped";
value1__borderColor = matched__borderColor; value1__borderColor = drop__borderColor;
value1__pointbackgroundColor = matched__pointbackgroundColor; value1__pointbackgroundColor = drop__pointbackgroundColor;
value1__backgroundColor = matched__backgroundColor; value1__backgroundColor = drop__backgroundColor;
} }
var ypkg_datasets = [{ var ypkg_datasets = [{
label: '# packets '+matched_text, label: '# packets '+dropped_text,
data: ypkgdata, data: ypkgdata,
borderWidth: 2, borderWidth: 2,
borderColor: value1__borderColor, borderColor: value1__borderColor,
...@@ -256,7 +264,7 @@ function plotGraph(route_then_action, data) ...@@ -256,7 +264,7 @@ function plotGraph(route_then_action, data)
//backgroundColor: "#99bfff" //backgroundColor: "#99bfff"
}]; }];
var ypkgrel_datasets = [{ var ypkgrel_datasets = [{
label: '# packets '+matched_text, label: '# packets '+dropped_text,
data: ypkgdatarel, data: ypkgdatarel,
borderWidth: 2, borderWidth: 2,
borderColor: value1__borderColor, borderColor: value1__borderColor,
...@@ -267,7 +275,7 @@ function plotGraph(route_then_action, data) ...@@ -267,7 +275,7 @@ function plotGraph(route_then_action, data)
//backgroundColor: "#ff877a" //backgroundColor: "#ff877a"
}]; }];
var ybytes_datasets = [{ var ybytes_datasets = [{
label: '# bytes '+matched_text, label: '# bytes '+dropped_text,
data: ybytesdata, data: ybytesdata,
borderWidth: 2, borderWidth: 2,
borderColor: value1__borderColor, borderColor: value1__borderColor,
...@@ -278,7 +286,7 @@ function plotGraph(route_then_action, data) ...@@ -278,7 +286,7 @@ function plotGraph(route_then_action, data)
//backgroundColor: "#99bfff" //backgroundColor: "#99bfff"
}]; }];
var ybytesrel_datasets = [{ var ybytesrel_datasets = [{
label: '# bytes '+matched_text, label: '# bytes '+dropped_text,
data: ybytesdatarel, data: ybytesdatarel,
borderWidth: 2, borderWidth: 2,
borderColor: value1__borderColor, borderColor: value1__borderColor,
...@@ -290,38 +298,38 @@ function plotGraph(route_then_action, data) ...@@ -290,38 +298,38 @@ function plotGraph(route_then_action, data)
}]; }];
if (ydropped_available) { if (ymatched_available) {
ypkg_datasets.push({ ypkg_datasets.push({
label: '# packets dropped', label: '# packets matched',
data: ydroppedpkgdata, data: ymatchedpkgdata,
borderWidth: 2, borderWidth: 2,
borderColor: drop__borderColor, borderColor: matched__borderColor,
pointBackgroundColor: drop__pointbackgroundColor, pointBackgroundColor: matched__pointbackgroundColor,
backgroundColor: drop__backgroundColor backgroundColor: matched__backgroundColor
}); });
ypkgrel_datasets.push({ ypkgrel_datasets.push({
label: '# packets dropped', label: '# packets matched',
data: ydroppedpkgdatarel, data: ymatchedpkgdatarel,
borderWidth: 2, borderWidth: 2,
borderColor: drop__borderColor, borderColor: matched__borderColor,
pointBackgroundColor: drop__pointbackgroundColor, pointBackgroundColor: matched__pointbackgroundColor,
backgroundColor: drop__backgroundColor backgroundColor: matched__backgroundColor
}); });
ybytes_datasets.push({ ybytes_datasets.push({
label: '# bytes dropped', label: '# bytes matched',
data: ydroppedbytesdata, data: ymatchedbytesdata,
borderWidth: 2, borderWidth: 2,
borderColor: drop__borderColor, borderColor: matched__borderColor,
pointBackgroundColor: drop__pointbackgroundColor, pointBackgroundColor: matched__pointbackgroundColor,
backgroundColor: drop__backgroundColor backgroundColor: matched__backgroundColor
}); });
ybytesrel_datasets.push({ ybytesrel_datasets.push({
label: '# bytes dropped', label: '# bytes matched',
data: ydroppedbytesdatarel, data: ymatchedbytesdatarel,
borderWidth: 2, borderWidth: 2,
borderColor: drop__borderColor, borderColor: matched__borderColor,
pointBackgroundColor: drop__pointbackgroundColor, pointBackgroundColor: matched__pointbackgroundColor,
backgroundColor: drop__backgroundColor backgroundColor: matched__backgroundColor
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment