From 923cba84851b460198260006b402c5a98e26bf9c Mon Sep 17 00:00:00 2001 From: xxchan Date: Thu, 14 Nov 2024 20:33:46 +0800 Subject: [PATCH] feat(dashboard): show cluster version (#19388) Signed-off-by: xxchan --- dashboard/lib/api/cluster.ts | 5 +++++ dashboard/pages/cluster.tsx | 6 ++++++ src/meta/src/dashboard/mod.rs | 5 +++++ src/meta/src/manager/diagnose.rs | 5 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dashboard/lib/api/cluster.ts b/dashboard/lib/api/cluster.ts index 0efc083309389..a1977c7c51e4c 100644 --- a/dashboard/lib/api/cluster.ts +++ b/dashboard/lib/api/cluster.ts @@ -35,3 +35,8 @@ export async function getClusterInfoComputeNode() { ) return res } + +export async function getClusterVersion() { + const res = await api.get("/version") + return res +} diff --git a/dashboard/pages/cluster.tsx b/dashboard/pages/cluster.tsx index eabc07741bcb1..7f356905ef247 100644 --- a/dashboard/pages/cluster.tsx +++ b/dashboard/pages/cluster.tsx @@ -36,6 +36,7 @@ import { getClusterInfoComputeNode, getClusterInfoFrontend, getClusterMetrics, + getClusterVersion, } from "../lib/api/cluster" import { WorkerNode } from "../proto/gen/common" @@ -142,6 +143,7 @@ export default function Cluster() { const [frontendList, setFrontendList] = useState([]) const [computeNodeList, setComputeNodeList] = useState([]) const [metrics, setMetrics] = useState() + const [version, setVersion] = useState() const toast = useErrorToast() useEffect(() => { @@ -149,6 +151,7 @@ export default function Cluster() { try { setFrontendList(await getClusterInfoFrontend()) setComputeNodeList(await getClusterInfoComputeNode()) + setVersion(await getClusterVersion()) } catch (e: any) { toast(e) } @@ -182,6 +185,9 @@ export default function Cluster() { const retVal = ( Cluster Overview + + Version: {version} + {frontendList.map((frontend) => ( ) -> Result> { + Ok(Json(risingwave_common::current_cluster_version())) + } } impl DashboardService { @@ -507,6 +511,7 @@ impl DashboardService { .allow_methods(vec![Method::GET]); let api_router = Router::new() + .route("/version", get(get_version)) .route("/clusters/:ty", get(list_clusters)) .route("/fragments2", get(list_fragments)) .route("/fragments/job_id/:job_id", get(list_fragments_by_job_id)) diff --git a/src/meta/src/manager/diagnose.rs b/src/meta/src/manager/diagnose.rs index de8f983056a6a..63c85d24465d8 100644 --- a/src/meta/src/manager/diagnose.rs +++ b/src/meta/src/manager/diagnose.rs @@ -70,8 +70,9 @@ impl DiagnoseCommand { let mut report = String::new(); let _ = writeln!( report, - "report created at: {}", - chrono::DateTime::::from(std::time::SystemTime::now()) + "report created at: {}\nversion: {}", + chrono::DateTime::::from(std::time::SystemTime::now()), + risingwave_common::current_cluster_version(), ); let _ = writeln!(report); self.write_catalog(&mut report).await;