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: add /zookeeper explorer #218

Merged
merged 3 commits into from
May 6, 2024
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
2 changes: 2 additions & 0 deletions app/[query]/clickhouse-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { settingsConfig } from './more/settings'
import { topUsageColumnsConfig } from './more/top-usage-columns'
import { topUsageTablesConfig } from './more/top-usage-tables'
import { usersConfig } from './more/users'
import { zookeeperConfig } from './more/zookeeper'
import { commonErrorsConfig } from './queries/common-errors'
import { expensiveQueriesConfig } from './queries/expensive-queries'
import { expensiveQueriesByMemoryConfig } from './queries/expensive-queries-by-memory'
Expand Down Expand Up @@ -61,6 +62,7 @@ export const queries: Array<QueryConfig> = [
asynchronousMetricsConfig,
usersConfig,
rolesConfig,
zookeeperConfig,
]

export const getQueryConfigByName = (
Expand Down
32 changes: 32 additions & 0 deletions app/[query]/more/zookeeper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ColumnFormat } from '@/components/data-table/column-defs'
import { type QueryConfig } from '@/lib/types/query-config'

export const zookeeperConfig: QueryConfig = {
name: 'zookeeper',
description: 'Zookeeper browser',
sql: `
SELECT *
FROM system.zookeeper
WHERE path = replaceOne({path: String}, '//', '/')
duyet marked this conversation as resolved.
Show resolved Hide resolved
`,
columns: [
'name',
'value',
'path',
'dataLength',
'numChildren',
'czxid',
'mzxid',
'ctime',
'mtime',
'version',
'cversion',
'aversion',
'ephemeralOwner',
],
columnFormats: {
name: [ColumnFormat.Link, { href: `/zookeeper?path=[path]/[name]` }],
value: ColumnFormat.CodeToggle,
},
defaultParams: { path: '/' },
}
2 changes: 1 addition & 1 deletion app/pageview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { usePathname, useSearchParams } from 'next/navigation'
import { useEffect } from 'react'

export async function PageView() {
export function PageView() {
const pathname = usePathname()
const searchParams = useSearchParams()

Expand Down
8 changes: 8 additions & 0 deletions menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
CombineIcon,
FilePlus2Icon,
HardDriveIcon,
RollerCoasterIcon,
UngroupIcon,
} from 'lucide-react'
import { type MenuItem } from './components/menu/types'
Expand Down Expand Up @@ -239,6 +240,13 @@ export const menuItemsConfig: MenuItem[] = [
'Information about clusters available in the config file and the servers in them',
icon: UngroupIcon,
},
{
title: 'Zookeeper',
href: '/zookeeper?path=/',
description:
'Exposes data from the Keeper cluster defined in the config',
icon: RollerCoasterIcon,
Comment on lines +244 to +248
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Consider adding a tooltip for the new Zookeeper menu item for consistency.

All other menu items have tooltips that provide additional context on hover. Adding a tooltip to the Zookeeper item would maintain UI consistency and enhance user experience.

Suggested change
title: 'Zookeeper',
href: '/zookeeper?path=/',
description:
'Exposes data from the Keeper cluster defined in the config',
icon: RollerCoasterIcon,
title: 'Zookeeper',
href: '/zookeeper?path=/',
description:
'Exposes data from the Keeper cluster defined in the config',
icon: RollerCoasterIcon,
tooltip: 'Manage and monitor your Zookeeper clusters',

},
],
},
]