RTT graph for all nodes uses the new graph interface and has fixed tooltips

This commit is contained in:
Herbert Wolverson
2023-07-18 16:59:37 +00:00
parent ed916bff11
commit 185c948112
4 changed files with 27 additions and 17 deletions
@@ -1,4 +1,4 @@
use crate::web::wss::{queries::time_period::InfluxTimePeriod, send_response};
use crate::web::wss::{queries::time_period::InfluxTimePeriod, send_response, influx_query_builder::InfluxQueryBuilder};
use axum::extract::ws::WebSocket;
use pgdb::{
organization_cache::get_org_details,
@@ -17,17 +17,16 @@ pub async fn send_rtt_for_all_nodes(
key: &str,
period: InfluxTimePeriod,
) -> anyhow::Result<()> {
if let Some(org) = get_org_details(cnn, key).await {
let result = query_rtt_all_nodes(&org, &period).await;
match result {
Err(e) => error!("Error querying InfluxDB for Per Node RTT: {e:?}"),
Ok(result) => {
let node_status = pgdb::node_status(cnn, key).await?;
let nodes = rtt_rows_to_result(result, node_status);
send_response(socket, wasm_pipe_types::WasmResponse::RttChart { nodes, histogram: Vec::new() }).await;
}
}
}
let rows = InfluxQueryBuilder::new(period.clone())
.with_measurement("rtt")
.with_fields(&["avg", "min", "max"])
.with_groups(&["host_id", "_field"])
.execute::<RttRow>(cnn, key)
.await?;
let node_status = pgdb::node_status(cnn, key).await?;
let nodes = rtt_rows_to_result(rows, node_status);
send_response(socket, wasm_pipe_types::WasmResponse::RttChart { nodes, histogram: Vec::new() }).await;
Ok(())
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -88,7 +88,18 @@ export class RttChart implements Component {
this.myChart.setOption<echarts.EChartsOption>(
(option = {
title: { text: "TCP Round-Trip Time" },
tooltip: { trigger: "axis" },
tooltip: {
trigger: "axis",
formatter: function (params: any) {
let ret = "";
for (let i=0; i<params.length; i+=3) {
if (params[i+2].value > 0) {
ret += "<strong>" + params[i+2].seriesName + "</strong>: " + params[i+2].value.toFixed(1) + " ms<br/>";
}
}
return ret;
}
},
legend: {
orient: "horizontal",
right: 10,