Skip to content

Commit

Permalink
feat(conprof): show conprof download link for TiCDC
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine committed Aug 23, 2023
1 parent 58349be commit 4ae5b2e
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 16 deletions.
1 change: 1 addition & 0 deletions pkg/apiserver/conprof/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type ComponentNum struct {
PD int `json:"pd"`
TiKV int `json:"tikv"`
TiFlash int `json:"tiflash"`
TiCDC int `json:"ticdc"`
}

type GroupProfiles struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export interface ConprofComponentNum {
* @memberof ConprofComponentNum
*/
'pd'?: number;
/**
*
* @type {number}
* @memberof ConprofComponentNum
*/
'ticdc'?: number;
/**
*
* @type {number}
Expand Down
3 changes: 3 additions & 0 deletions ui/packages/tidb-dashboard-client/swagger/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3923,6 +3923,9 @@
"pd": {
"type": "integer"
},
"ticdc": {
"type": "integer"
},
"tidb": {
"type": "integer"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{ "tidb": "TiDB", "tikv": "TiKV", "pd": "PD", "tiflash": "TiFlash" }
{
"tidb": "TiDB",
"tikv": "TiKV",
"pd": "PD",
"tiflash": "TiFlash",
"ticdc": "TiCDC"
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tidb":"TiDB","tikv":"TiKV","pd":"PD","tiflash":"TiFlash"}
{"tidb":"TiDB","tikv":"TiKV","pd":"PD","tiflash":"TiFlash","ticdc":"TiCDC"}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ function expandDisksItems(rows: HostinfoInfo[]): IExpandedDiskItem[] {
pd: 0,
tidb: 0,
tikv: 0,
tiflash: 0
tiflash: 0,
ticdc: 0
}
}
instancesPerPartition[i.partition_path_lower!][i.type!]++
Expand Down Expand Up @@ -72,7 +73,8 @@ function expandDisksItems(rows: HostinfoInfo[]): IExpandedDiskItem[] {
pd: 0,
tidb: 0,
tikv: 0,
tiflash: 0
tiflash: 0,
ticdc: 0
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function expandHostItems(rows: HostinfoInfo[]): IExpandedHostItem[] {
pd: 0,
tidb: 0,
tikv: 0,
tiflash: 0
tiflash: 0,
ticdc: 0
}

Object.values(row.instances ?? {}).forEach((i) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,21 @@ export default function Page() {
{
name: t('conprof.list.table.columns.targets'),
key: 'targets',
minWidth: 150,
maxWidth: 250,
minWidth: 250,
maxWidth: 300,
onRender: (rec) => {
const { tikv, tidb, pd, tiflash } = rec.component_num
const s = `${tikv} ${instanceKindName(
const { tikv, tidb, pd, tiflash, ticdc } = rec.component_num
let s = `${tikv} ${instanceKindName(
'tikv'
)}, ${tidb} ${instanceKindName('tidb')}, ${pd} ${instanceKindName(
'pd'
)}, ${tiflash} ${instanceKindName('tiflash')}`
return <span>{s}</span>
// to be compatible with old version
// this field doesn't not exist in the old version
if (ticdc !== undefined) {
s = `${s}, ${ticdc} ${instanceKindName('ticdc')}`
}
return s
}
},
{
Expand Down Expand Up @@ -166,8 +171,8 @@ export default function Page() {
{
name: t('conprof.list.table.columns.start_at'),
key: 'ts',
minWidth: 160,
maxWidth: 220,
minWidth: 200,
maxWidth: 250,
onRender: (rec) => {
return <DateTime.Long unixTimestampMs={rec.ts * 1000} />
}
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/tidb-dashboard-lib/src/client/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ export interface ConprofComponentNum {
* @memberof ConprofComponentNum
*/
'pd'?: number;
/**
*
* @type {number}
* @memberof ConprofComponentNum
*/
'ticdc'?: number;
/**
*
* @type {number}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default function ValueDisplay({
pd: newInstanceStat(),
tidb: newInstanceStat(),
tikv: newInstanceStat(),
tiflash: newInstanceStat()
tiflash: newInstanceStat(),
ticdc: newInstanceStat()
}
items.forEach((item) => {
instanceStats[item.instanceKind].all++
Expand Down
5 changes: 2 additions & 3 deletions ui/packages/tidb-dashboard-lib/src/utils/instanceTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import {
TopologyStoreInfo
} from '@lib/client'

export type InstanceKind = 'pd' | 'tidb' | 'tikv' | 'tiflash'

export const InstanceKinds: InstanceKind[] = ['pd', 'tidb', 'tikv', 'tiflash']
export const InstanceKinds = ['pd', 'tidb', 'tikv', 'tiflash', 'ticdc'] as const
export type InstanceKind = typeof InstanceKinds[number]

export const InstanceStatus = {
Unreachable: 0,
Expand Down
2 changes: 2 additions & 0 deletions util/distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type DistributionResource struct {
TiKV string `json:"tikv,omitempty"`
PD string `json:"pd,omitempty"`
TiFlash string `json:"tiflash,omitempty"`
TiCDC string `json:"ticdc,omitempty"`
}

var defaultDistroRes = DistributionResource{
Expand All @@ -30,6 +31,7 @@ var defaultDistroRes = DistributionResource{
TiKV: "TiKV",
PD: "PD",
TiFlash: "TiFlash",
TiCDC: "TiCDC",
}

var (
Expand Down

0 comments on commit 4ae5b2e

Please sign in to comment.