Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): show cluster version (#19388) #19395

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -495,6 +495,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 @@ -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))
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
Loading