-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
82638: docs/rfcs: split up jobs system tables r=dt a=dt Release note: none. Epic: none. 130693: cluster-ui: new db page components r=xinhaoz a=xinhaoz Only the latest 2 commits should be reviewed. ------------------------- cluster-ui: add layouts dir with some base layout components This commit adds shared layout components to align spacing within new db console pages. Components to start off: - PageLayout - page content wrapper - PageSection - page section wrapper Epic: [CRDB-37558](https://cockroachlabs.atlassian.net/browse/CRDB-37558) Release note: None ----------------------------- cluster-ui: new db page components This commit adds the new db page, with components under the `databasesv2` dir. The page currently uses mocked data and does not support pagination or sorting. The page is available for preview under the new route, `/v2/databases`. We'll eventually replace the existing db routes with the new components. Epic: none Fixes: #130674 Release note: None 130830: crosscluster/logical: use poller-collection for replicated time r=dt a=dt jobs/metricspoller: add optional 'highwater' metric from polled progress Many of our jobs maintain 'highwater' timestamps in their progress, reflecting the timestamp up to which they have processed. Many users of these jobs wish to monitor them via timeseries and exported metrics. However exporting these highwater timestamps via metrics has proven difficult to do directly from a running job for a few reasons, including the fact that many jobs may be running, so we need to reliably export the worst-case number and that each node exports its own number, so an aggregator will need to find the worst across those nodes. While this all is possible, an added complication is that if no node is executing a given job, its number is not moving and thus likely the most important to include in the worst-case, but when each job is responsible for pushing its number into the metric, this does not happen. This change instead extends our 'metrics poller' job that inspects the state of the jobs system to update certain metrics so that it can be asked to find the minimum timestamp across all jobs of a given type and update a metric for that type to the found number. Release note: none. Epic: none. Co-authored-by: David Taylor <[email protected]> Co-authored-by: Xin Hao Zhang <[email protected]>
- Loading branch information
Showing
17 changed files
with
843 additions
and
8 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
pkg/ui/workspaces/cluster-ui/src/databasesV2/databaseTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
export type DatabaseRow = { | ||
name: string; | ||
id: number; | ||
approximateDiskSizeMiB: number; | ||
tableCount: number; | ||
rangeCount: number; | ||
nodesByRegion: Record<string, number[]>; | ||
schemaInsightsCount: number; | ||
key: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { Space } from "antd"; | ||
import React, { useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
import Select, { OptionsType } from "react-select"; | ||
|
||
import { PageLayout, PageSection } from "src/layouts"; | ||
import { PageConfig, PageConfigItem } from "src/pageConfig"; | ||
import PageCount from "src/sharedFromCloud/pageCount"; | ||
import { PageHeader } from "src/sharedFromCloud/pageHeader"; | ||
import { Search } from "src/sharedFromCloud/search"; | ||
import { ReactSelectOption } from "src/types/selectTypes"; | ||
|
||
import { Table, TableColumnProps } from "../sharedFromCloud/table"; | ||
import useTable from "../sharedFromCloud/useTable"; | ||
import { Bytes, EncodeDatabaseUri } from "../util"; | ||
|
||
import { DatabaseRow } from "./databaseTypes"; | ||
|
||
const mockRegionOptions = [ | ||
{ label: "US East (N. Virginia)", value: "us-east-1" }, | ||
{ label: "US East (Ohio)", value: "us-east-2" }, | ||
]; | ||
|
||
const mockData: DatabaseRow[] = new Array(20).fill(1).map((_, i) => ({ | ||
name: `myDB-${i}`, | ||
id: i, | ||
approximateDiskSizeMiB: i * 100, | ||
tableCount: i, | ||
rangeCount: i, | ||
nodesByRegion: { | ||
[mockRegionOptions[0].value]: [1, 2], | ||
[mockRegionOptions[1].value]: [3], | ||
}, | ||
schemaInsightsCount: i, | ||
key: i.toString(), | ||
})); | ||
|
||
const filters = {}; | ||
|
||
const initialParams = { | ||
filters, | ||
pagination: { | ||
page: 1, | ||
pageSize: 10, | ||
}, | ||
search: "", | ||
sort: { | ||
field: "name", | ||
order: "asc" as const, | ||
}, | ||
}; | ||
|
||
const columns: TableColumnProps<DatabaseRow>[] = [ | ||
{ | ||
title: "Name", | ||
sorter: true, | ||
render: (db: DatabaseRow) => { | ||
const encodedDBPath = EncodeDatabaseUri(db.name); | ||
// TODO (xzhang: For CC we have to use `${location.pathname}/${db.name}` | ||
return <Link to={encodedDBPath}>{db.name}</Link>; | ||
}, | ||
}, | ||
{ | ||
title: "Size", | ||
sorter: true, | ||
render: (db: DatabaseRow) => { | ||
return Bytes(db.approximateDiskSizeMiB); | ||
}, | ||
}, | ||
{ | ||
title: "Tables", | ||
sorter: true, | ||
render: (db: DatabaseRow) => { | ||
return db.tableCount; | ||
}, | ||
}, | ||
{ | ||
title: "Ranges", | ||
sorter: true, | ||
render: (db: DatabaseRow) => { | ||
return db.rangeCount; | ||
}, | ||
}, | ||
{ | ||
title: "Regions / Nodes", | ||
render: (db: DatabaseRow) => ( | ||
<Space direction="vertical"> | ||
{db.nodesByRegion && | ||
Object.keys(db.nodesByRegion).map( | ||
region => `${region}: ${db.nodesByRegion[region].length}`, | ||
)} | ||
</Space> | ||
), | ||
}, | ||
{ | ||
title: "Schema insights", | ||
render: (db: DatabaseRow) => { | ||
return db.schemaInsightsCount; | ||
}, | ||
}, | ||
]; | ||
|
||
export const DatabasesPageV2 = () => { | ||
const { setSearch } = useTable({ | ||
initial: initialParams, | ||
}); | ||
const data = mockData; | ||
|
||
const [nodeRegions, setNodeRegions] = useState<ReactSelectOption[]>([]); | ||
const onNodeRegionsChange = (selected: OptionsType<ReactSelectOption>) => { | ||
setNodeRegions((selected ?? []).map(v => v)); | ||
}; | ||
|
||
return ( | ||
<PageLayout> | ||
<PageHeader title="Databases" /> | ||
<PageSection> | ||
<PageConfig> | ||
<PageConfigItem> | ||
<Search placeholder="Search databases" onSubmit={setSearch} /> | ||
</PageConfigItem> | ||
<PageConfigItem minWidth={"200px"}> | ||
<Select | ||
placeholder={"Regions"} | ||
name="nodeRegions" | ||
options={mockRegionOptions} | ||
clearable={true} | ||
isMulti | ||
value={nodeRegions} | ||
onChange={onNodeRegionsChange} | ||
/> | ||
</PageConfigItem> | ||
</PageConfig> | ||
</PageSection> | ||
<PageSection> | ||
<PageCount | ||
page={1} | ||
pageSize={10} | ||
total={data.length} | ||
entity="databases" | ||
/> | ||
<Table | ||
columns={columns} | ||
dataSource={data} | ||
pagination={{ | ||
size: "small", | ||
current: 1, | ||
pageSize: 10, | ||
showSizeChanger: false, | ||
position: ["bottomCenter"], | ||
total: data.length, | ||
}} | ||
onChange={(_pagination, _sorter) => {}} | ||
/> | ||
</PageSection> | ||
</PageLayout> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
export * from "./pageSection"; | ||
export * from "./pageLayout"; |
7 changes: 7 additions & 0 deletions
7
pkg/ui/workspaces/cluster-ui/src/layouts/pageLayout.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import "src/core/index.module"; | ||
|
||
.page-layout { | ||
flex-grow: 0; | ||
width: 100%; | ||
padding-right: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import classNames from "classnames/bind"; | ||
import React from "react"; | ||
|
||
import styles from "./pageLayout.module.scss"; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
export const PageLayout: React.FC = ({ children }) => { | ||
return <div className={cx("page-layout")}>{children}</div>; | ||
}; |
6 changes: 6 additions & 0 deletions
6
pkg/ui/workspaces/cluster-ui/src/layouts/pageSection.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import "src/core/index.module"; | ||
|
||
.page-section { | ||
margin-bottom: 16px; | ||
} | ||
|
Oops, something went wrong.