-
Notifications
You must be signed in to change notification settings - Fork 15
feat: improve tenant diagnostics - CPU #2633
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const columns = React.useMemo(() => { | ||
return getTenantOverviewTopQueriesColumns(); | ||
}, []); | ||
|
||
const {currentData, isFetching, error} = topQueriesApi.useGetTopQueriesQuery( | ||
{database: tenantName, timeFrame: 'hour', limit: TENANT_OVERVIEW_TABLES_LIMIT}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sortOrder
is needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, stand redeployed
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the tenant diagnostics CPU section by simplifying the UI structure and enhancing the user experience. The main changes include replacing a complex tabbed interface with a unified dashboard layout and improving scroll position management for better navigation.
Key changes:
- Replaced CPU tabs (nodes/shards/queries) with a unified vertical layout using StatsWrapper components
- Extracted reusable QueriesTableWithDrawer component for better code reuse
- Added scroll position persistence for the diagnostics overview tab
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/utils/hooks/useScrollPosition.ts | New hook for managing scroll position persistence using sessionStorage |
src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TenantCpu.tsx | Complete refactor from tabbed to unified layout with StatsWrapper components |
src/containers/Tenant/Diagnostics/TopQueries/QueriesTableWithDrawer.tsx | New reusable component combining table and drawer functionality |
src/containers/Tenant/Diagnostics/TenantOverview/StatsWrapper/StatsWrapper.tsx | New wrapper component for consistent section layouts |
src/components/SeeAllButton/SeeAllButton.tsx | New reusable button component for navigation to detailed views |
src/containers/Tenant/Diagnostics/TopQueries/columns/columns.tsx | Refactored to use parameterized query text columns |
src/containers/Tenant/Diagnostics/Diagnostics.tsx | Added scroll position hook integration |
src/utils/hooks/useScrollPosition.ts
Outdated
import {debounce} from 'lodash'; | ||
import {useHistory} from 'react-router-dom'; | ||
|
||
const DEBAUNCE_DELAY = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant name 'DEBAUNCE_DELAY' contains a typo. It should be 'DEBOUNCE_DELAY'.
const DEBAUNCE_DELAY = 100; | |
const DEBOUNCE_DELAY = 100; |
Copilot uses AI. Check for mistakes.
const queryHashColumn: Column<KeyValueRow> = { | ||
name: QUERIES_COLUMNS_IDS.QueryHash, | ||
header: QUERIES_COLUMNS_TITLES.QueryHash, | ||
render: ({row}) => generateHash(String(row.QueryText)), | ||
render: ({row}) => <div className={b('query-hash')}>{generateHash(String(row.QueryText))}</div>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Adding a wrapper div with CSS class for the query hash changes the column behavior. Consider if this styling change is necessary or if it should be handled differently to maintain consistency with other hash displays.
render: ({row}) => <div className={b('query-hash')}>{generateHash(String(row.QueryText))}</div>, | |
render: ({row}) => generateHash(String(row.QueryText)), |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
} | ||
export function getRunningQueriesColumns() { | ||
const columns = [ | ||
queryHashColumn, | ||
userSIDColumn, | ||
queryStartColumn, | ||
queryTextColumn, | ||
getQueryTextColumn(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe create getRunningQueryTextColumn and getTopQueryTextColumn
I dont see that we use functions for columns - and current solution looks inconsistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude what do you think of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @astandrik's task —— View job
@astandrik, I've analyzed the column patterns across the codebase, and I agree with your suggestion. Here's my analysis:
Current Codebase Patterns
After reviewing the column definitions across the codebase, I found that the established pattern is to use individual get*Column
functions rather than parameterized functions. Examples:
-
nodesColumns (src/components/nodesColumns/columns.tsx:37-94):
getNodeIdColumn()
getHostColumn()
getNetworkHostColumn()
(different variant, not parameterized)getDataCenterColumn()
-
Operations (src/containers/Operations/columns.tsx:21-29):
- Uses a single
getColumns()
function that builds all columns internally based on thekind
parameter - Doesn't use parameterized individual column functions
- Uses a single
-
TopicData (src/containers/Tenant/Diagnostics/TopicData/columns/columns.tsx):
- Exports individual column constants:
offsetColumn
,timestampCreateColumn
, etc. - No parameterized column functions
- Exports individual column constants:
-
SchemaViewer (src/containers/Tenant/Schema/SchemaViewer/columns.tsx):
- Also uses individual column constants:
idColumn
,nameColumn
, etc.
- Also uses individual column constants:
Recommendation
The current PR approach of having separate functions would be more consistent:
getRunningQueryTextColumn()
getTopQueryTextColumn()
This follows the established pattern in the codebase where different column variants get their own functions rather than using parameters. The getNetworkHostColumn()
vs getHostColumn()
example from nodesColumns is a good precedent for this approach.
The parameterized approach would be a departure from the existing patterns and might make the codebase less consistent overall.
Todo:
- Read the current columns.tsx implementation
- Search for other column patterns in the codebase
- Provide feedback on the consistency question
Stand redeployed |
Claude finished @Raubzeug's task —— View job Code Review SummaryI've completed my review of this PR that refactors the tenant diagnostics CPU section. Here are my findings: ✅ Strengths
🔍 Issues to Address
📋 Recommendations
✅ All Critical Requirements Met
The PR significantly improves the code structure and user experience. The issues found are minor and don't block the functionality. |
@claude actually some you addressed are already fixed |
Claude finished @astandrik's task —— View job Thanks for the clarification @astandrik! I've checked the current state of the code and you're right - some issues have been fixed. ✅ Issues Already Fixed
🔍 Remaining Issues
📊 Overall AssessmentThe PR successfully improves the tenant diagnostics CPU section with:
The remaining issues are minor and don't affect the functionality. Great work on the refactoring! |
Stand
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 85.35 MB | Main: 85.35 MB
Diff: +3.95 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information