-
Notifications
You must be signed in to change notification settings - Fork 57
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
Traces - Gantt chart / Span list rework #2257
Conversation
…list nesting Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
Just a heads up here, while we are mostly getting in good shape with our Traces CI can you please add unit tests and cypress tests for these new workflows and bug fixed workflows? Thanks! |
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
isFullScreen: boolean; | ||
} | ||
|
||
export const FullScreenWrapper: React.FC<FullScreenWrapperProps> = ({ |
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.
could you add some comments above to explain what it does or why it's needed
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.
Added above
//EUI Data grid full screen button is currently broken, this is a workaround using overlay mask
@@ -73,6 +73,10 @@ export function TracesContent(props: TracesProps) { | |||
const [includeMetrics, setIncludeMetrics] = useState(false); | |||
const isNavGroupEnabled = coreRefs?.chrome?.navGroup.getNavGroupEnabled(); | |||
|
|||
useEffect(() => { |
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.
Can this useEffect be merged with the one on line number: 95
https://github.com/opensearch-project/dashboards-observability/pull/2257/files#diff-102a88265e317b8fd409fdb0aafb158beb0a68bec9b93f971e49ee8965fca62fR95-R122
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.
Yes added the new dependencies to the use effect
startTime,
endTime,
props.dataSourceMDSId,
This triggers the refresh
@@ -15,6 +15,8 @@ interface PltProps { | |||
onHoverHandler?: (event: Readonly<Plotly.PlotMouseEvent>) => void; | |||
onUnhoverHandler?: (event: Readonly<Plotly.PlotMouseEvent>) => void; | |||
onClickHandler?: (event: Readonly<Plotly.PlotMouseEvent>) => void; | |||
onSelectedHandler?: (event: Readonly<Plotly.PlotSelectionEvent>) => void; | |||
onRelayout?: (event: any) => void; |
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.
Should this be onRelayout?: (event: Readonly<Plotly.PlotSelectionEvent>) => void
can refrin from using any as type.
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.
Updated
showFullScreenSelector: false, | ||
additionalControls: toolbarButtons, | ||
}} | ||
style={{ height: fullScreenMode ? '100%' : '500px', overflowY: 'auto' }} |
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.
Why is the datagrid restricted to 500px when not in fullscreen? Does this change on a bigger screen?
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.
Auto can't be used as the window is initially rendered with the tree collapsed. So the window becomes roughly 50 pixels that is scrollable. 500pixels matches the limit of the "Span Tree" and keeps the window size for that panel consistent.
position: 'fixed', | ||
top: 0, | ||
left: 0, | ||
width: '100vw', | ||
height: '100vh', | ||
backgroundColor: '#fff', | ||
zIndex: 9999, | ||
display: 'flex', | ||
flexDirection: 'column', |
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.
Can add a class here and move the custom styling to index.scss
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.
Added classes and move to scss file
.full-screen-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: #fff;
z-index: 9999;
display: flex;
flex-direction: column;
}
.full-screen-close-icon {
position: absolute;
top: 4px;
right: 4px;
z-index: 10000;
}
.full-screen-content {
flex: 1 1 auto;
overflow: auto;
}
useEffect(() => { | ||
refresh(); | ||
}, [startTime, endTime, props.dataSourceMDSId]); | ||
|
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.
Can we please merge this useEffect with the one on line : 83
https://github.com/opensearch-project/dashboards-observability/pull/2257/files#diff-6c41c2b6f0e21b1b29ad6d3cf28e92d0c5fc6bad2fbead527862b0634246ced8R83-R107
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.
Yes added the new dependencies to the use effect
startTime,
endTime,
props.dataSourceMDSId,
This triggers the refresh
it('handles view toggle button group', () => { | ||
const wrapper = mount(<SpanDetailPanel {...mockProps} />); | ||
const toggleButtons = wrapper.find(EuiButtonGroup); | ||
expect(toggleButtons).toHaveLength(1); | ||
|
||
// Verify initial state is 'timeline' | ||
expect(toggleButtons.prop('idSelected')).toBe('timeline'); | ||
|
||
// Simulate changing the toggle | ||
act(() => { | ||
toggleButtons.prop('onChange')!('span_list'); | ||
}); | ||
|
||
wrapper.update(); | ||
|
||
// Verify the toggle button group has been updated | ||
const updatedToggleButtons = wrapper.find(EuiButtonGroup); | ||
expect(updatedToggleButtons.prop('idSelected')).toBe('span_list'); | ||
}); |
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.
For this test I feel we are testing the button and not what our page is rendering on button click. The button is already tested in OUI, we should rather test on button change is the rendered component changing to gantt-chart, table or tree view.
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.
Removed the test as this functionality is covered by OUI and the table specific checks should be done in span_detail_table
</div> | ||
); | ||
case 'durationInNanos': | ||
return `${round(nanoToMilliSec(Math.max(0, value)), 2)} ms`; |
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.
What's with the names here, where the column's id says 'nanos' but the function for the render seems to be showing milliseconds, where it calls a method named 'nanoToMilliSec'?
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.
I kept that from the originally implementation which has been in place for 3 years, not sure the original reasoning.
dde9588#diff-491203dc294dcf7e9d988e5ba55b77471fccebc3e7d3d62c42dd0b0a6a365599R136
Signed-off-by: Adam Tackett <[email protected]>
await act(() => { | ||
ReactDOM.render( | ||
<SpanDetailTable | ||
<SpanDetailTableHierarchy | ||
http={httpClientMock} | ||
hiddenColumns={['traceId', 'traceGroup']} | ||
DSL={{}} | ||
openFlyout={(spanId: string) => setCurrentSpan(spanId)} | ||
mode='data_prepper' | ||
mode="data_prepper" | ||
dataSourceMDSId="testDataSource" |
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.
Post snapshot check, we should add some tests to see if expand/collapse is working or not as that is the main functionality of this view.
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.
Covered with added cypress testing as follows:
describe('Testing traces tree view',
it('Verifies tree view and table toggle functionality with expand/collapse logic',
it('Verifies tree view expand arrow functionality',
it('Verifies span flyout',
it('Handles toggling between full screen and regular modes',
const updateAvailableWidth = () => { | ||
if (containerRef.current) { | ||
setAvailableWidth(containerRef.current.getBoundingClientRect().width); | ||
} else { | ||
setAvailableWidth(window.innerWidth); | ||
} | ||
}; | ||
|
||
const handleFullScreenChange = () => { | ||
const isFullscreenActive = !!document.fullscreenElement; | ||
setIsFullScreen(isFullscreenActive); | ||
updateAvailableWidth(); | ||
}; |
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.
Nit. I personally don't ride with adding the function definitions inside useEffect(). But is not a blocker.
}, []); | ||
|
||
const dynamicLayoutAdjustment = useMemo(() => { | ||
return isLocked ? availableWidth - 350 : availableWidth - 150; |
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.
Should this change when new home is enabled/disabled? Is the pixel width of the sidebar constant with and without the new home?
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.
Updated:
const dynamicLayoutAdjustment = useMemo(() => {
const newNavigation = coreRefs?.chrome?.navGroup.getNavGroupEnabled?.();
const adjustment = newNavigation ? 350 : 400;
return isLocked ? availableWidth - adjustment : availableWidth - 150;
}, [isLocked, availableWidth]);
onRelayout={(event) => { | ||
// Handle x-axis range update | ||
if (event && event['xaxis.range[0]'] && event['xaxis.range[1]']) { | ||
const newRange = [event['xaxis.range[0]'], event['xaxis.range[1]']]; | ||
setSelectedRange(newRange); | ||
} else { | ||
setSelectedRange(fullRange); | ||
} | ||
}} |
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.
Nit - not blocking. Just for good readability do you want to follow how other props functions are declared and used here. Something like onClick
.
interface Span { | ||
spanId: string; | ||
parentSpanId?: string; | ||
children: Span[]; | ||
[key: string]: any; | ||
} | ||
|
||
type SpanMap = Record<string, Span>; |
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.
nit. Not blocker if these are re-usable contants, we can move these to https://github.com/opensearch-project/dashboards-observability/blob/main/public/components/common/types.ts
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
Signed-off-by: Adam Tackett <[email protected]>
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.
Can see the cypress tests passed! Thanks for the changes. The non-blocking changes can be done in the upcoming PRs.
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/dashboards-observability/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-observability/backport-2.x
# Create a new branch
git switch --create backport/backport-2257-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ab396b94a14f922220e5ec071bc4f696208650b3
# Push it to GitHub
git push --set-upstream origin backport/backport-2257-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-observability/backport-2.x Then, create a pull request where the |
* fix refresh on timepicker change, update gannt chart, mini map, span list nesting Signed-off-by: Adam Tackett <[email protected]> * ui changes and new tab for spans Signed-off-by: Adam Tackett <[email protected]> * ui updates, additional bug fixes Signed-off-by: Adam Tackett <[email protected]> * add eui grid full screen, testing Signed-off-by: Adam Tackett <[email protected]> * add back table height for tree, cap left margin Signed-off-by: Adam Tackett <[email protected]> * add some jest testing Signed-off-by: Adam Tackett <[email protected]> * address comments Signed-off-by: Adam Tackett <[email protected]> * test Signed-off-by: Adam Tackett <[email protected]> * test remove Signed-off-by: Adam Tackett <[email protected]> * add cypress testing, conditional check for new nav Signed-off-by: Adam Tackett <[email protected]> * fix width of tables Signed-off-by: Adam Tackett <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]> (cherry picked from commit ab396b9)
…ework (#2283) * Traces - Gantt chart / Span list rework (#2257) * fix refresh on timepicker change, update gannt chart, mini map, span list nesting Signed-off-by: Adam Tackett <[email protected]> * ui changes and new tab for spans Signed-off-by: Adam Tackett <[email protected]> * ui updates, additional bug fixes Signed-off-by: Adam Tackett <[email protected]> * add eui grid full screen, testing Signed-off-by: Adam Tackett <[email protected]> * add back table height for tree, cap left margin Signed-off-by: Adam Tackett <[email protected]> * add some jest testing Signed-off-by: Adam Tackett <[email protected]> * address comments Signed-off-by: Adam Tackett <[email protected]> * test Signed-off-by: Adam Tackett <[email protected]> * test remove Signed-off-by: Adam Tackett <[email protected]> * add cypress testing, conditional check for new nav Signed-off-by: Adam Tackett <[email protected]> * fix width of tables Signed-off-by: Adam Tackett <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]> (cherry picked from commit ab396b9) * fix loaddash error, update snapshots Signed-off-by: Adam Tackett <[email protected]> * add missing format change Signed-off-by: Adam Tackett <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]>
Demo:
GanttChart.mp4
Description
Updates to gantt chart:
Updates to Span list:
General fixes:
Overall Look:
Tree View:
MiniMap and zoom:
Screen.Recording.2024-12-03.at.11.30.06.AM.mov
Resizing Fix:
Screen.Recording.2024-12-03.at.11.31.07.AM.mov
Issues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.