-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixes #19860: Added Diagnostic tab to display diagnostic information || Added Sync offset button #19980
Open
dhruvjsx
wants to merge
11
commits into
open-metadata:main
Choose a base branch
from
dhruvjsx:dhruv
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixes #19860: Added Diagnostic tab to display diagnostic information || Added Sync offset button #19980
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e74d8b2
fixed: pagination for deleted users
e472034
fixed test cases
bf9283b
fixed comments
1303172
used admin token to authenticate
9d74ecb
feature: added Diagnostic info tab
f64b8ac
Merge branch 'main' into dhruv
karanh37 8c09959
fixed comments
f537ae7
Merge remote-tracking branch 'origin/dhruv' into dhruv
1614997
fixed github comments
f9a7ef5
fixed github comments
ffa250b
fixed github comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
...rc/components/Alerts/AlertDetails/AlertDiagnosticInfo/AlertDiagnosticInfoTab.interface.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,27 @@ | ||
/* | ||
* Copyright 2024 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export interface AlertDiagnosticData { | ||
latestOffset: number; | ||
currentOffset: number; | ||
startingOffset: number; | ||
hasProcessedAllEvents: boolean; | ||
successfulEventsCount: number; | ||
failedEventsCount: number; | ||
relevantUnprocessedEventsCount: number; | ||
totalUnprocessedEventsCount: number; | ||
} | ||
|
||
export interface AlertDiagnosticInfoTabProps { | ||
diagnosticData: AlertDiagnosticData; | ||
} | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
68 changes: 68 additions & 0 deletions
68
...ui/src/components/Alerts/AlertDetails/AlertDiagnosticInfo/AlertDiagnosticInfoTab.test.tsx
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,68 @@ | ||
/* | ||
* Copyright 2025 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { | ||
mockDiagnosticData, | ||
mockEmptyDiagnosticData, | ||
} from '../../../../mocks/Alerts.mock'; | ||
import AlertDiagnosticInfoTab from './AlertDiagnosticInfoTab'; | ||
|
||
describe('AlertDiagnosticInfoTab', () => { | ||
it('should render all offset information correctly', () => { | ||
render(<AlertDiagnosticInfoTab diagnosticData={mockDiagnosticData} />); | ||
|
||
const inputs = screen.getAllByTestId('input-field'); | ||
|
||
// Check labels | ||
expect(screen.getByText('label.latest-offset:')).toBeInTheDocument(); | ||
expect(screen.getByText('label.current-offset:')).toBeInTheDocument(); | ||
expect(screen.getByText('label.starting-offset:')).toBeInTheDocument(); | ||
expect( | ||
screen.getByText('label.successful-event-plural:') | ||
).toBeInTheDocument(); | ||
expect(screen.getByText('label.failed-event-plural:')).toBeInTheDocument(); | ||
expect( | ||
screen.getByText('label.processed-all-event-plural:') | ||
).toBeInTheDocument(); | ||
|
||
// Check input values | ||
expect(inputs[0]).toHaveValue('100'); | ||
expect(inputs[1]).toHaveValue('80'); | ||
expect(inputs[2]).toHaveValue('0'); | ||
expect(inputs[3]).toHaveValue('75'); | ||
expect(inputs[4]).toHaveValue('5'); | ||
expect(inputs[5]).toHaveValue('Yes'); | ||
}); | ||
|
||
it('should render processed all events status as "No" when false', () => { | ||
render(<AlertDiagnosticInfoTab diagnosticData={mockEmptyDiagnosticData} />); | ||
|
||
const inputs = screen.getAllByTestId('input-field'); | ||
|
||
expect(inputs[5]).toHaveValue('No'); | ||
}); | ||
|
||
it('should render with empty/zero values correctly', () => { | ||
render(<AlertDiagnosticInfoTab diagnosticData={mockEmptyDiagnosticData} />); | ||
|
||
const inputs = screen.getAllByTestId('input-field'); | ||
|
||
// Check numeric fields have value "0" | ||
expect(inputs[0]).toHaveValue('0'); // latestOffset | ||
expect(inputs[1]).toHaveValue('0'); // currentOffset | ||
expect(inputs[2]).toHaveValue('0'); // startingOffset | ||
expect(inputs[3]).toHaveValue('0'); // successfulEventsCount | ||
expect(inputs[4]).toHaveValue('0'); // failedEventsCount | ||
}); | ||
}); |
115 changes: 115 additions & 0 deletions
115
...rces/ui/src/components/Alerts/AlertDetails/AlertDiagnosticInfo/AlertDiagnosticInfoTab.tsx
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,115 @@ | ||
/* | ||
* Copyright 2024 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { InfoCircleOutlined } from '@ant-design/icons'; | ||
import { Card, Col, Input, Row, Tooltip } from 'antd'; | ||
import React, { useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { GRAYED_OUT_COLOR } from '../../../../constants/constants'; | ||
import './alert-diagnostic-info-tab.less'; | ||
import { AlertDiagnosticInfoTabProps } from './AlertDiagnosticInfoTab.interface'; | ||
|
||
interface DiagnosticItem { | ||
key: string; | ||
value: string | number | boolean; | ||
description: string; | ||
} | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const DiagnosticItemRow = ({ item }: { item: DiagnosticItem }) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Col span={12}> | ||
<Row align="middle"> | ||
<Col className="d-flex items-center" span={10}> | ||
<span className="d-flex items-center gap-1"> | ||
<p className="text-grey-muted m-0">{t(item.key)}:</p> | ||
<Tooltip placement="bottom" title={item.description}> | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<InfoCircleOutlined | ||
className="info-icon" | ||
style={{ color: GRAYED_OUT_COLOR }} | ||
/> | ||
</Tooltip> | ||
</span> | ||
</Col> | ||
<Col span={10}> | ||
<Input | ||
readOnly | ||
className="w-full border-none" | ||
data-testid="input-field" | ||
value={ | ||
typeof item.value === 'boolean' | ||
? item.value | ||
? 'Yes' | ||
: 'No' | ||
: item.value | ||
} | ||
/> | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Col> | ||
</Row> | ||
</Col> | ||
); | ||
}; | ||
|
||
function AlertDiagnosticInfoTab({ | ||
diagnosticData, | ||
}: AlertDiagnosticInfoTabProps) { | ||
const diagnosticItems = useMemo( | ||
() => [ | ||
{ | ||
key: 'label.latest-offset', | ||
value: diagnosticData?.latestOffset, | ||
description: 'The latest offset of the event in the system.', | ||
}, | ||
{ | ||
key: 'label.current-offset', | ||
value: diagnosticData?.currentOffset, | ||
description: 'The current offset of the event subscription.', | ||
}, | ||
{ | ||
key: 'label.starting-offset', | ||
value: diagnosticData?.startingOffset, | ||
description: | ||
'The initial offset of the event subscription when it started processing.', | ||
}, | ||
{ | ||
key: 'label.successful-event-plural', | ||
value: diagnosticData?.successfulEventsCount, | ||
description: 'Count of successful events for specific alert.', | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
{ | ||
key: 'label.failed-event-plural', | ||
value: diagnosticData?.failedEventsCount, | ||
description: 'Count of failed events for specific alert.', | ||
}, | ||
{ | ||
key: 'label.processed-all-event-plural', | ||
value: diagnosticData?.hasProcessedAllEvents, | ||
description: 'Indicates whether all events have been processed.', | ||
}, | ||
], | ||
[diagnosticData] | ||
); | ||
|
||
return ( | ||
<Card> | ||
<Row className="w-full" gutter={[16, 16]}> | ||
{diagnosticItems.map((item) => ( | ||
<DiagnosticItemRow item={item} key={item.key} /> | ||
))} | ||
</Row> | ||
</Card> | ||
); | ||
} | ||
|
||
export default React.memo(AlertDiagnosticInfoTab); |
68 changes: 68 additions & 0 deletions
68
.../ui/src/components/Alerts/AlertDetails/AlertDiagnosticInfo/alert-diagnostic-info-tab.less
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,68 @@ | ||
/* | ||
* Copyright 2025 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
.alert-diagnostic-container { | ||
.ant-card { | ||
border-radius: 8px; | ||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); | ||
transition: all 0.3s ease; | ||
|
||
&:hover { | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
} | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.ant-input { | ||
&[readonly] { | ||
background-color: transparent; | ||
cursor: default; | ||
} | ||
} | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
.ant-statistic { | ||
.ant-statistic-title { | ||
color: rgba(0, 0, 0, 0.45); | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
font-size: 14px; | ||
} | ||
|
||
.ant-statistic-content { | ||
font-size: 24px; | ||
font-weight: 600; | ||
} | ||
} | ||
|
||
.ant-typography { | ||
margin-bottom: 16px; | ||
} | ||
|
||
.text-grey-muted { | ||
color: rgba(0, 0, 0, 0.45); | ||
} | ||
} | ||
|
||
.label-info-wrapper { | ||
display: inline-flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
gap: 2px !important; | ||
dhruvjsx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.info-icon { | ||
color: #c4c4c4; | ||
font-size: 14px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.text-grey-muted { | ||
display: inline; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The styles do not match the class name we are giving. Use a completely different class with all the stylings if there are many, or just use the pre-defined classes for the specific style. Ex. in this case |
||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't need to create a separate alert just for the diagnostics info check. Can we add a test for a created alert somewhere above?