From df07ffbce4a77f7f0a6335acfae99c0b7e7cccf0 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 0efc08330938..a1977c7c51e4 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 eabc07741bcb..7f356905ef24 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 { @@ -505,6 +509,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("/streaming_jobs", get(list_streaming_jobs)) .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 f2d2cd58dd49..fd4d67c25668 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;