Misc cleanup

This commit is contained in:
Herbert Wolverson 2023-08-07 21:36:58 +00:00
parent a6d8d8c7e6
commit 583cc506a0
5 changed files with 9 additions and 49 deletions

View File

@ -62,45 +62,3 @@ fn rtt_rows_to_result(rows: Vec<RttSiteRow>, node_status: Vec<NodeStatus>) -> Ve
}
result
}
const TREE_QUERY: &str = "
import \"join\"
import \"sql\"
sqlData =
sql.from(
driverName: \"postgres\",
dataSourceName: \"postgresql://license:license@127.0.0.1:5432/libreqos\",
query: \"WITH RECURSIVE children
(index, site_name, level, parent) AS (
SELECT index, site_name, 0, parent FROM site_tree WHERE key='%KEY%' and index = %SITE%
UNION ALL
SELECT
st.index,
st.site_name,
children.level + 1,
children.parent
FROM site_tree st, children
WHERE children.index = st.parent AND children.level < 2 AND key='%KEY%'
)
SELECT DISTINCT circuit_id FROM shaped_devices WHERE key='%KEY%'
AND parent_node IN (SELECT site_name FROM children);\",
)
bitsData = from(bucket: \"izones\")
|> range(start: -5m)
|> filter(fn: (r) => r[\"_measurement\"] == \"rtt\")
|> filter(fn: (r) => r[\"organization_id\"] == \"%KEY%\")
|> filter(fn: (r) => r[\"_field\"] == \"avg\" or r[\"_field\"] == \"max\" or r[\"_field\"] == \"min\")
|> filter(fn: (r) => r[\"_value\"] > 0 and r[\"circuit_id\"] != \"unknown\")
|> aggregateWindow(every: 10s, fn: mean, createEmpty: false)
|> group()
|> limit(n : 500)
join.inner(left: bitsData, right: sqlData, on: (l,r) => l.circuit_id == r.circuit_id, as: (l,r) => ({l with rightValue: r.circuit_id}))
|> drop(columns: [\"circuit_id\", \"ip\", \"organization_id\"])
|> group(columns: [\"_field\", \"host_id\"])
|> aggregateWindow(every: 10s, fn: median, createEmpty: false)
";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ export class AccessPointPage implements Page {
new SiteInfo(siteId),
new SiteBreadcrumbs(siteId),
new ThroughputSiteChart(siteId),
new RttChartSite(siteId),
new RttChartSite(siteId, 1.0),
new SiteHeat(siteId),
new SiteStackChart(siteId),
];

View File

@ -8,12 +8,14 @@ export class RttChartSite implements Component {
myChart: echarts.ECharts;
chartMade: boolean = false;
siteId: string;
multiplier: number;
constructor(siteId: string) {
constructor(siteId: string, multiplier: number = 10.0) {
this.siteId = siteId;
this.div = document.getElementById("rttChart") as HTMLElement;
this.myChart = echarts.init(this.div);
this.myChart.showLoading();
this.multiplier = multiplier;
}
wireup(): void {
@ -43,7 +45,7 @@ export class RttChartSite implements Component {
let l: number[] = [];
for (let j=0; j<node.rtt.length; j++) {
if (first) x.push(node.rtt[j].date);
d.push(node.rtt[j].value * 10.0);
d.push(node.rtt[j].value * this.multiplier);
u.push(node.rtt[j].u);
l.push(node.rtt[j].l);
}