Skip to content

Commit

Permalink
feat(dashboard): show cluster version (#19388)
Browse files Browse the repository at this point in the history
Signed-off-by: xxchan <[email protected]>
  • Loading branch information
xxchan authored Nov 14, 2024
1 parent c920694 commit df07ffb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions dashboard/lib/api/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ export async function getClusterInfoComputeNode() {
)
return res
}

export async function getClusterVersion() {
const res = await api.get("/version")
return res
}
6 changes: 6 additions & 0 deletions dashboard/pages/cluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
getClusterInfoComputeNode,
getClusterInfoFrontend,
getClusterMetrics,
getClusterVersion,
} from "../lib/api/cluster"
import { WorkerNode } from "../proto/gen/common"

Expand Down Expand Up @@ -142,13 +143,15 @@ export default function Cluster() {
const [frontendList, setFrontendList] = useState<WorkerNode[]>([])
const [computeNodeList, setComputeNodeList] = useState<WorkerNode[]>([])
const [metrics, setMetrics] = useState<ClusterNodeMetrics>()
const [version, setVersion] = useState<string>()
const toast = useErrorToast()

useEffect(() => {
async function doFetch() {
try {
setFrontendList(await getClusterInfoFrontend())
setComputeNodeList(await getClusterInfoComputeNode())
setVersion(await getClusterVersion())
} catch (e: any) {
toast(e)
}
Expand Down Expand Up @@ -182,6 +185,9 @@ export default function Cluster() {
const retVal = (
<Box p={3}>
<Title>Cluster Overview</Title>
<Text textColor="gray.500" m={0}>
Version: {version}
</Text>
<Grid my={3} templateColumns="repeat(3, 1fr)" gap={6} width="full">
{frontendList.map((frontend) => (
<GridItem
Expand Down
5 changes: 5 additions & 0 deletions src/meta/src/dashboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ pub(super) mod handlers {

Ok(all.into())
}

pub async fn get_version(Extension(_srv): Extension<Service>) -> Result<Json<String>> {
Ok(Json(risingwave_common::current_cluster_version()))
}
}

impl DashboardService {
Expand All @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions src/meta/src/manager/diagnose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ impl DiagnoseCommand {
let mut report = String::new();
let _ = writeln!(
report,
"report created at: {}",
chrono::DateTime::<chrono::offset::Utc>::from(std::time::SystemTime::now())
"report created at: {}\nversion: {}",
chrono::DateTime::<chrono::offset::Utc>::from(std::time::SystemTime::now()),
risingwave_common::current_cluster_version(),
);
let _ = writeln!(report);
self.write_catalog(&mut report).await;
Expand Down

0 comments on commit df07ffb

Please sign in to comment.