From ac8da2cfc9a22d34e557b6cbe2f2bc93ab362e84 Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Thu, 3 Apr 2025 12:01:38 +0530 Subject: [PATCH 01/11] Persist expanded iciclegraph state in URL --- ui/packages/shared/components/src/hooks/URLState/index.tsx | 2 +- .../profile/src/ProfileView/hooks/useVisualizationState.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index 9f0a0b6b490..65cfb60bbc5 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -144,7 +144,7 @@ export const useURLStateCustom = ( const [urlValue, setURLValue] = useURLState(param, _options); const val = useMemo(() => { - return parse(urlValue); + return parse(decodeURIComponent(urlValue)); }, [parse, urlValue]); const setVal = useCallback( diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index c3500a1c77a..50dc73c6ee7 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -11,9 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {useCallback, useState} from 'react'; +import {useCallback} from 'react'; -import {useURLState} from '@parca/components'; +import {useURLState, useURLStateCustom} from '@parca/components'; import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow'; @@ -30,7 +30,7 @@ export const useVisualizationState = (): { clearSelection: () => void; setGroupByLabels: (labels: string[]) => void; } => { - const [curPath, setCurPath] = useState([]); + const [curPath, setCurPath] = useURLStateCustom('cur_path', {parse: JSON.parse, stringify: JSON.stringify, defaultValue: '[]'}); const [currentSearchString, setSearchString] = useURLState('search_string'); const [colorStackLegend] = useURLState('color_stack_legend'); const [colorBy] = useURLState('color_by'); From 971fea4ad795ad2c2b1818f5c2ccd558b3e611a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 06:34:13 +0000 Subject: [PATCH 02/11] [pre-commit.ci lite] apply automatic fixes --- .../profile/src/ProfileView/hooks/useVisualizationState.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 50dc73c6ee7..93f9446fd36 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -30,7 +30,11 @@ export const useVisualizationState = (): { clearSelection: () => void; setGroupByLabels: (labels: string[]) => void; } => { - const [curPath, setCurPath] = useURLStateCustom('cur_path', {parse: JSON.parse, stringify: JSON.stringify, defaultValue: '[]'}); + const [curPath, setCurPath] = useURLStateCustom('cur_path', { + parse: JSON.parse, + stringify: JSON.stringify, + defaultValue: '[]', + }); const [currentSearchString, setSearchString] = useURLState('search_string'); const [colorStackLegend] = useURLState('color_stack_legend'); const [colorBy] = useURLState('color_by'); From a6ff8744147c5292f02e96d852bb2d66bdf93403 Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Thu, 3 Apr 2025 12:17:46 +0530 Subject: [PATCH 03/11] Typefix --- .../profile/src/ProfileView/hooks/useVisualizationState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 93f9446fd36..47c7ba5e7e2 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -31,7 +31,7 @@ export const useVisualizationState = (): { setGroupByLabels: (labels: string[]) => void; } => { const [curPath, setCurPath] = useURLStateCustom('cur_path', { - parse: JSON.parse, + parse: (val) => JSON.parse(val as string ?? '[]'), stringify: JSON.stringify, defaultValue: '[]', }); From f74e8a3d6560ed251f52493ad8e4b63cd051674b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 06:49:00 +0000 Subject: [PATCH 04/11] [pre-commit.ci lite] apply automatic fixes --- .../profile/src/ProfileView/hooks/useVisualizationState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 47c7ba5e7e2..4065451346e 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -31,7 +31,7 @@ export const useVisualizationState = (): { setGroupByLabels: (labels: string[]) => void; } => { const [curPath, setCurPath] = useURLStateCustom('cur_path', { - parse: (val) => JSON.parse(val as string ?? '[]'), + parse: val => JSON.parse((val as string) ?? '[]'), stringify: JSON.stringify, defaultValue: '[]', }); From c919e6d7d76323ed13f5ed084981abda1bc4499e Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Mon, 7 Apr 2025 17:43:58 +0530 Subject: [PATCH 05/11] Moving the whole frame info to urlState during flamegraph expansion --- .../components/src/hooks/URLState/index.tsx | 8 ++++ .../IcicleGraphArrow/ContextMenu.tsx | 5 ++- .../IcicleGraphArrow/IcicleGraphNodes.tsx | 21 +++++----- .../IcicleGraphArrow/index.tsx | 6 +-- .../IcicleGraphArrow/utils.ts | 42 +++++++++++++++++++ .../profile/src/ProfileIcicleGraph/index.tsx | 12 ++++-- .../components/DashboardItems/index.tsx | 11 ++++- .../ProfileView/components/Toolbars/index.tsx | 9 ++-- .../hooks/useVisualizationState.ts | 16 ++++--- .../shared/profile/src/ProfileView/index.tsx | 10 +++-- 10 files changed, 109 insertions(+), 31 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index 65cfb60bbc5..ee859e2248b 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -157,4 +157,12 @@ export const useURLStateCustom = ( return [val, setVal]; }; +export const JSONSerializer = (val: object): string => { + return JSON.stringify(val, (_, v) => typeof v === 'bigint' ? v.toString() : v); +}; + +export const JSONParser = (val: string): T => { + return JSON.parse(val); +} + export default URLStateContext; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx index 2638f016365..a217686b898 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx @@ -24,6 +24,7 @@ import {getLastItem} from '@parca/utilities'; import {useGraphTooltip} from '../../GraphTooltipArrow/useGraphTooltip'; import {useGraphTooltipMetaInfo} from '../../GraphTooltipArrow/useGraphTooltipMetaInfo'; import {hexifyAddress, truncateString} from '../../utils'; +import { CurrentPathFrame } from './utils'; interface ContextMenuProps { menuId: string; @@ -36,8 +37,8 @@ interface ContextMenuProps { level: number; compareAbsolute: boolean; trackVisibility: (isVisible: boolean) => void; - curPath: string[]; - setCurPath: (path: string[]) => void; + curPath: CurrentPathFrame[]; + setCurPath: (path: CurrentPathFrame[]) => void; hideMenu: () => void; hideBinary: (binaryToRemove: string) => void; } diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx index fe0bbce18cf..e44e1c25abb 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx @@ -33,7 +33,7 @@ import { FIELD_MAPPING_FILE, } from './index'; import useNodeColor from './useNodeColor'; -import {arrowToString, nodeLabel} from './utils'; +import { arrowToString, CurrentPathFrame, getCurrentPathFrameData, isCurrentPathFrameMatch, nodeLabel } from './utils'; export const RowHeight = 26; @@ -48,11 +48,11 @@ interface IcicleGraphNodesProps { total: bigint; totalWidth: number; level: number; - curPath: string[]; - setCurPath: (path: string[]) => void; + curPath: CurrentPathFrame[]; + setCurPath: (path: CurrentPathFrame[]) => void; setHoveringRow: (row: number | null) => void; setHoveringLevel: (level: number | null) => void; - path: string[]; + path: CurrentPathFrame[]; xScale: (value: bigint) => number; searchString?: string; sortBy: string; @@ -104,7 +104,7 @@ export const IcicleGraphNodes = React.memo(function IcicleGraphNodesNoMemo({ childRows = curPath.length === 0 ? childRows - : childRows.filter(c => nodeLabel(table, c, level, false) === curPath[0]); + : childRows.filter(c => isCurrentPathFrameMatch(table, c, level, curPath[0])); let childrenCumulative = BigInt(0); const childrenElements: ReactNode[] = []; @@ -159,15 +159,15 @@ export interface IcicleNodeProps { y: number; height: number; totalWidth: number; - curPath: string[]; + curPath: CurrentPathFrame[]; level: number; table: Table; row: number; colors: colorByColors; colorBy: string; - path: string[]; + path: CurrentPathFrame[]; total: bigint; - setCurPath: (path: string[]) => void; + setCurPath: (path: CurrentPathFrame[]) => void; setHoveringRow: (row: number | null) => void; setHoveringLevel: (level: number | null) => void; xScale: (value: bigint) => number; @@ -343,8 +343,9 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ const name = useMemo(() => { return isRoot ? 'root' : nodeLabel(table, row, level, binaries.length > 1); }, [table, row, level, isRoot, binaries]); - const nextPath = path.concat([name]); - const isFaded = curPath.length > 0 && name !== curPath[curPath.length - 1]; + const currentPathFrame: CurrentPathFrame = getCurrentPathFrameData(table, row, level); + const nextPath = path.concat([currentPathFrame]); + const isFaded = curPath.length > 0 && !isCurrentPathFrameMatch(table, row, level, curPath[curPath.length - 1]); const styles = isFaded ? fadedIcicleRectStyles : icicleRectStyles; const nextLevel = level + 1; const nextCurPath = curPath.length === 0 ? [] : curPath.slice(1); diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx index b62d0e8aa4d..b2fb29c6af7 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx @@ -38,7 +38,7 @@ import ContextMenu from './ContextMenu'; import {IcicleChartRootNode} from './IcicleChartRootNode'; import {IcicleNode, RowHeight, colorByColors} from './IcicleGraphNodes'; import {useFilenamesList} from './useMappingList'; -import {arrowToString, extractFeature, extractFilenameFeature} from './utils'; +import { arrowToString, CurrentPathFrame, extractFeature, extractFilenameFeature } from './utils'; export const FIELD_LABELS_ONLY = 'labels_only'; export const FIELD_MAPPING_FILE = 'mapping_file'; @@ -66,8 +66,8 @@ interface IcicleGraphArrowProps { profileType?: ProfileType; profileSource?: ProfileSource; width?: number; - curPath: string[]; - setCurPath: (path: string[]) => void; + curPath: CurrentPathFrame[]; + setCurPath: (path: CurrentPathFrame[]) => void; sortBy: string; flamegraphLoading: boolean; isHalfScreen: boolean; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts index 920df952cec..f2b1c756192 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts @@ -26,6 +26,7 @@ import {MergedProfileSource, ProfileSource} from '../../ProfileSource'; import {BigIntDuo, hexifyAddress} from '../../utils'; import { FIELD_FUNCTION_NAME, + FIELD_INLINED, FIELD_LABELS_ONLY, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE, @@ -149,3 +150,44 @@ export const boundsFromProfileSource = (profileSource?: ProfileSource): BigIntDu return [start, end]; }; + +export interface CurrentPathFrame { + functionName: string; + systemName: string; + fileName: string; + lineNumber: number; + inlined: boolean; +} + +export const getCurrentPathFrameData = ( + table: Table, + row: number, + level: number +): CurrentPathFrame => { + const functionName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); + const systemName: string | null = arrowToString( + table.getChild(FIELD_FUNCTION_NAME)?.get(row) + ); + const fileName: string | null = arrowToString(table.getChild(FIELD_MAPPING_FILE)?.get(row)); + const lineNumber: bigint = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n; + const inlined: boolean | null = table.getChild(FIELD_INLINED)?.get(row); + + return { + functionName: functionName ?? '', + systemName: systemName ?? '', + fileName: fileName ?? '', + lineNumber: Number(lineNumber), + inlined: inlined ?? false, + }; +} + +export function isCurrentPathFrameMatch(table: Table, row: number, level: number, b: CurrentPathFrame): boolean { + const a = getCurrentPathFrameData(table, row, level); + return ( + a.functionName === b.functionName && + a.systemName === b.systemName && + a.fileName === b.fileName && + a.lineNumber === b.lineNumber && + a.inlined === b.inlined + ); +} diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx index b1607c5e8a0..c9e9af0afbd 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx @@ -28,7 +28,7 @@ import {TimelineGuide} from '../TimelineGuide'; import {IcicleGraph} from './IcicleGraph'; import {FIELD_FUNCTION_NAME, IcicleGraphArrow} from './IcicleGraphArrow'; import useMappingList from './IcicleGraphArrow/useMappingList'; -import {boundsFromProfileSource} from './IcicleGraphArrow/utils'; +import { boundsFromProfileSource, CurrentPathFrame } from './IcicleGraphArrow/utils'; const numberFormatter = new Intl.NumberFormat('en-US'); @@ -44,6 +44,8 @@ interface ProfileIcicleGraphProps { profileSource?: ProfileSource; curPath: string[] | []; setNewCurPath: (path: string[]) => void; + curPathArrow: CurrentPathFrame[] | []; + setNewCurPathArrow: (path: CurrentPathFrame[]) => void; loading: boolean; setActionButtons?: (buttons: React.JSX.Element) => void; error?: any; @@ -64,6 +66,8 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ filtered, curPath, setNewCurPath, + curPathArrow, + setNewCurPathArrow, profileType, loading, error, @@ -191,8 +195,8 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ arrow={arrow} total={total} filtered={filtered} - curPath={curPath} - setCurPath={setNewCurPath} + curPath={curPathArrow} + setCurPath={setNewCurPathArrow} profileType={profileType} sortBy={storeSortBy as string} flamegraphLoading={isLoading} @@ -216,6 +220,8 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ filtered, curPath, setNewCurPath, + curPathArrow, + setNewCurPathArrow, profileType, storeSortBy, isHalfScreen, diff --git a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx index 94ab82074f8..57eefb96823 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx @@ -27,6 +27,7 @@ import type { TopTableData, VisualizationType, } from '../../types/visualization'; +import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; interface GetDashboardItemProps { type: VisualizationType; @@ -42,6 +43,8 @@ interface GetDashboardItemProps { filtered: bigint; curPath: string[]; setNewCurPath: (path: string[]) => void; + curPathArrow: CurrentPathFrame[]; + setNewCurPathArrow: (path: CurrentPathFrame[]) => void; currentSearchString?: string; setSearchString?: (value: string) => void; callgraphSVG?: string; @@ -64,6 +67,8 @@ export const getDashboardItem = ({ filtered, curPath, setNewCurPath, + curPathArrow, + setNewCurPathArrow, currentSearchString, setSearchString, callgraphSVG, @@ -83,6 +88,8 @@ export const getDashboardItem = ({ {}} + curPathArrow={[]} + setNewCurPathArrow={() => { }} arrow={flamechartData?.arrow} total={total} filtered={filtered} diff --git a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx index 1544c8b9934..b74d04ea752 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx @@ -28,6 +28,7 @@ import ShareButton from '../ShareButton'; import ViewSelector from '../ViewSelector'; import MultiLevelDropdown from './MultiLevelDropdown'; import TableColumnsDropdown from './TableColumnsDropdown'; +import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; export interface VisualisationToolbarProps { groupBy: string[]; @@ -37,8 +38,8 @@ export interface VisualisationToolbarProps { profileSource?: ProfileSource; queryClient?: QueryServiceClient; onDownloadPProf: () => void; - curPath: string[]; - setNewCurPath: (path: string[]) => void; + curPath: CurrentPathFrame[]; + setNewCurPath: (path: CurrentPathFrame[]) => void; profileType?: ProfileType; total: bigint; filtered: bigint; @@ -61,8 +62,8 @@ export interface TableToolbarProps { } export interface IcicleGraphToolbarProps { - curPath: string[]; - setNewCurPath: (path: string[]) => void; + curPath: CurrentPathFrame[]; + setNewCurPath: (path: CurrentPathFrame[]) => void; } export const TableToolbar: FC = ({ diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 47c7ba5e7e2..8530de33c2b 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -11,15 +11,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {useCallback} from 'react'; +import {useCallback, useState} from 'react'; -import {useURLState, useURLStateCustom} from '@parca/components'; +import {JSONParser, JSONSerializer, useURLState, useURLStateCustom} from '@parca/components'; import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow'; +import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; export const useVisualizationState = (): { curPath: string[]; setCurPath: (path: string[]) => void; + curPathArrow: CurrentPathFrame[]; + setCurPathArrow: (path: CurrentPathFrame[]) => void; currentSearchString: string | undefined; setSearchString: (searchString: string | undefined) => void; colorStackLegend: string | undefined; @@ -30,9 +33,10 @@ export const useVisualizationState = (): { clearSelection: () => void; setGroupByLabels: (labels: string[]) => void; } => { - const [curPath, setCurPath] = useURLStateCustom('cur_path', { - parse: (val) => JSON.parse(val as string ?? '[]'), - stringify: JSON.stringify, + const [curPath, setCurPath] = useState([]); + const [curPathArrow, setCurPathArrow] = useURLStateCustom('cur_path', { + parse: JSONParser, + stringify: JSONSerializer, defaultValue: '[]', }); const [currentSearchString, setSearchString] = useURLState('search_string'); @@ -73,6 +77,8 @@ export const useVisualizationState = (): { return { curPath, setCurPath, + curPathArrow, + setCurPathArrow, currentSearchString, setSearchString, colorStackLegend, diff --git a/ui/packages/shared/profile/src/ProfileView/index.tsx b/ui/packages/shared/profile/src/ProfileView/index.tsx index a7e352d2283..1adeccf9c0d 100644 --- a/ui/packages/shared/profile/src/ProfileView/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/index.tsx @@ -58,6 +58,8 @@ export const ProfileView = ({ const { curPath, setCurPath, + curPathArrow, + setCurPathArrow, currentSearchString, setSearchString, colorStackLegend, @@ -107,6 +109,8 @@ export const ProfileView = ({ filtered, curPath, setNewCurPath: setCurPath, + curPathArrow, + setNewCurPathArrow: setCurPathArrow, currentSearchString, setSearchString, callgraphSVG, @@ -115,7 +119,7 @@ export const ProfileView = ({ }; const actionButtons = { - icicle: , + icicle: , table: ( Date: Mon, 7 Apr 2025 12:16:31 +0000 Subject: [PATCH 06/11] [pre-commit.ci lite] apply automatic fixes --- .../shared/components/src/hooks/URLState/index.tsx | 4 ++-- .../IcicleGraphArrow/ContextMenu.tsx | 2 +- .../IcicleGraphArrow/IcicleGraphNodes.tsx | 11 +++++++++-- .../ProfileIcicleGraph/IcicleGraphArrow/index.tsx | 2 +- .../ProfileIcicleGraph/IcicleGraphArrow/utils.ts | 13 ++++++++----- .../shared/profile/src/ProfileIcicleGraph/index.tsx | 2 +- .../ProfileView/components/DashboardItems/index.tsx | 5 +++-- .../src/ProfileView/components/Toolbars/index.tsx | 2 +- .../src/ProfileView/hooks/useVisualizationState.ts | 3 ++- 9 files changed, 28 insertions(+), 16 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index ee859e2248b..10b28409c28 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -158,11 +158,11 @@ export const useURLStateCustom = ( }; export const JSONSerializer = (val: object): string => { - return JSON.stringify(val, (_, v) => typeof v === 'bigint' ? v.toString() : v); + return JSON.stringify(val, (_, v) => (typeof v === 'bigint' ? v.toString() : v)); }; export const JSONParser = (val: string): T => { return JSON.parse(val); -} +}; export default URLStateContext; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx index a217686b898..0c81b8cec7f 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx @@ -24,7 +24,7 @@ import {getLastItem} from '@parca/utilities'; import {useGraphTooltip} from '../../GraphTooltipArrow/useGraphTooltip'; import {useGraphTooltipMetaInfo} from '../../GraphTooltipArrow/useGraphTooltipMetaInfo'; import {hexifyAddress, truncateString} from '../../utils'; -import { CurrentPathFrame } from './utils'; +import {CurrentPathFrame} from './utils'; interface ContextMenuProps { menuId: string; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx index e44e1c25abb..0026035e4d6 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx @@ -33,7 +33,13 @@ import { FIELD_MAPPING_FILE, } from './index'; import useNodeColor from './useNodeColor'; -import { arrowToString, CurrentPathFrame, getCurrentPathFrameData, isCurrentPathFrameMatch, nodeLabel } from './utils'; +import { + CurrentPathFrame, + arrowToString, + getCurrentPathFrameData, + isCurrentPathFrameMatch, + nodeLabel, +} from './utils'; export const RowHeight = 26; @@ -345,7 +351,8 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ }, [table, row, level, isRoot, binaries]); const currentPathFrame: CurrentPathFrame = getCurrentPathFrameData(table, row, level); const nextPath = path.concat([currentPathFrame]); - const isFaded = curPath.length > 0 && !isCurrentPathFrameMatch(table, row, level, curPath[curPath.length - 1]); + const isFaded = + curPath.length > 0 && !isCurrentPathFrameMatch(table, row, level, curPath[curPath.length - 1]); const styles = isFaded ? fadedIcicleRectStyles : icicleRectStyles; const nextLevel = level + 1; const nextCurPath = curPath.length === 0 ? [] : curPath.slice(1); diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx index b2fb29c6af7..2b00bec2b2f 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx @@ -38,7 +38,7 @@ import ContextMenu from './ContextMenu'; import {IcicleChartRootNode} from './IcicleChartRootNode'; import {IcicleNode, RowHeight, colorByColors} from './IcicleGraphNodes'; import {useFilenamesList} from './useMappingList'; -import { arrowToString, CurrentPathFrame, extractFeature, extractFilenameFeature } from './utils'; +import {CurrentPathFrame, arrowToString, extractFeature, extractFilenameFeature} from './utils'; export const FIELD_LABELS_ONLY = 'labels_only'; export const FIELD_MAPPING_FILE = 'mapping_file'; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts index f2b1c756192..763bb1db48d 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts @@ -165,9 +165,7 @@ export const getCurrentPathFrameData = ( level: number ): CurrentPathFrame => { const functionName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); - const systemName: string | null = arrowToString( - table.getChild(FIELD_FUNCTION_NAME)?.get(row) - ); + const systemName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); const fileName: string | null = arrowToString(table.getChild(FIELD_MAPPING_FILE)?.get(row)); const lineNumber: bigint = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n; const inlined: boolean | null = table.getChild(FIELD_INLINED)?.get(row); @@ -179,9 +177,14 @@ export const getCurrentPathFrameData = ( lineNumber: Number(lineNumber), inlined: inlined ?? false, }; -} +}; -export function isCurrentPathFrameMatch(table: Table, row: number, level: number, b: CurrentPathFrame): boolean { +export function isCurrentPathFrameMatch( + table: Table, + row: number, + level: number, + b: CurrentPathFrame +): boolean { const a = getCurrentPathFrameData(table, row, level); return ( a.functionName === b.functionName && diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx b/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx index c9e9af0afbd..94431302ab4 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/index.tsx @@ -28,7 +28,7 @@ import {TimelineGuide} from '../TimelineGuide'; import {IcicleGraph} from './IcicleGraph'; import {FIELD_FUNCTION_NAME, IcicleGraphArrow} from './IcicleGraphArrow'; import useMappingList from './IcicleGraphArrow/useMappingList'; -import { boundsFromProfileSource, CurrentPathFrame } from './IcicleGraphArrow/utils'; +import {CurrentPathFrame, boundsFromProfileSource} from './IcicleGraphArrow/utils'; const numberFormatter = new Intl.NumberFormat('en-US'); diff --git a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx index 57eefb96823..8eead2171ee 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx @@ -13,6 +13,8 @@ import {Profiler, ProfilerOnRenderCallback} from 'react'; +import {CurrentPathFrame} from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; + import {ConditionalWrapper} from '@parca/components'; import Callgraph from '../../../Callgraph'; @@ -27,7 +29,6 @@ import type { TopTableData, VisualizationType, } from '../../types/visualization'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; interface GetDashboardItemProps { type: VisualizationType; @@ -116,7 +117,7 @@ export const getDashboardItem = ({ curPath={[]} setNewCurPath={() => {}} curPathArrow={[]} - setNewCurPathArrow={() => { }} + setNewCurPathArrow={() => {}} arrow={flamechartData?.arrow} total={total} filtered={filtered} diff --git a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx index b74d04ea752..4ff63c9fb3c 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx @@ -14,6 +14,7 @@ import {FC} from 'react'; import {Icon} from '@iconify/react'; +import {CurrentPathFrame} from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; import {QueryServiceClient} from '@parca/client'; import {Button, UserPreferencesModal} from '@parca/components'; @@ -28,7 +29,6 @@ import ShareButton from '../ShareButton'; import ViewSelector from '../ViewSelector'; import MultiLevelDropdown from './MultiLevelDropdown'; import TableColumnsDropdown from './TableColumnsDropdown'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; export interface VisualisationToolbarProps { groupBy: string[]; diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 8530de33c2b..7399d319918 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -13,10 +13,11 @@ import {useCallback, useState} from 'react'; +import {CurrentPathFrame} from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; + import {JSONParser, JSONSerializer, useURLState, useURLStateCustom} from '@parca/components'; import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; export const useVisualizationState = (): { curPath: string[]; From 3e6a28467149bf9b8d05db53c5cd72f868c0d9c5 Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Tue, 8 Apr 2025 10:11:58 +0530 Subject: [PATCH 07/11] Type check fixes --- ui/packages/shared/components/src/hooks/URLState/index.tsx | 4 ++-- .../src/ProfileView/components/DashboardItems/index.tsx | 2 +- .../profile/src/ProfileView/components/Toolbars/index.tsx | 2 +- .../profile/src/ProfileView/hooks/useVisualizationState.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index ee859e2248b..07e3958c10e 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -161,8 +161,8 @@ export const JSONSerializer = (val: object): string => { return JSON.stringify(val, (_, v) => typeof v === 'bigint' ? v.toString() : v); }; -export const JSONParser = (val: string): T => { - return JSON.parse(val); +export const JSONParser = (val: ParamValue): T => { + return JSON.parse(val as string); } export default URLStateContext; diff --git a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx index 57eefb96823..d4b95f16732 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx @@ -27,7 +27,7 @@ import type { TopTableData, VisualizationType, } from '../../types/visualization'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; +import { CurrentPathFrame } from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; interface GetDashboardItemProps { type: VisualizationType; diff --git a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx index b74d04ea752..94e7b881f1b 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx @@ -28,7 +28,7 @@ import ShareButton from '../ShareButton'; import ViewSelector from '../ViewSelector'; import MultiLevelDropdown from './MultiLevelDropdown'; import TableColumnsDropdown from './TableColumnsDropdown'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; +import { CurrentPathFrame } from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; export interface VisualisationToolbarProps { groupBy: string[]; diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 8530de33c2b..3ef287c9fb5 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -16,7 +16,7 @@ import {useCallback, useState} from 'react'; import {JSONParser, JSONSerializer, useURLState, useURLStateCustom} from '@parca/components'; import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow'; -import { CurrentPathFrame } from 'ProfileIcicleGraph/IcicleGraphArrow/utils'; +import { CurrentPathFrame } from '../../ProfileIcicleGraph/IcicleGraphArrow/utils'; export const useVisualizationState = (): { curPath: string[]; From bfe7180e4972a1034f2a28573ea0f2242b2c72ad Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 04:46:00 +0000 Subject: [PATCH 08/11] [pre-commit.ci lite] apply automatic fixes --- .../components/src/hooks/URLState/index.tsx | 18 +++++++-------- .../components/DashboardItems/index.tsx | 18 +++++++-------- .../ProfileView/components/Toolbars/index.tsx | 22 +++++++++---------- .../hooks/useVisualizationState.ts | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index 49ef9e4e545..acf4ce7da5a 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -23,9 +23,9 @@ import { useState, } from 'react'; -import { type NavigateFunction } from '@parca/utilities'; +import {type NavigateFunction} from '@parca/utilities'; -import { getQueryParamsFromURL, sanitize, type ParamValue } from './utils'; +import {getQueryParamsFromURL, sanitize, type ParamValue} from './utils'; type ParamValueSetter = (val: ParamValue) => void; @@ -53,7 +53,7 @@ export const URLStateProvider = ({ }); return ( - + {children} ); @@ -74,9 +74,9 @@ export const useURLState = ( throw new Error('useURLState must be used within a URLStateProvider'); } - const { debugLog, defaultValue, alwaysReturnArray } = _options ?? {}; + const {debugLog, defaultValue, alwaysReturnArray} = _options ?? {}; - const { navigateTo, state, setState, defaultValues } = context; + const {navigateTo, state, setState, defaultValues} = context; const setParam: ParamValueSetter = useCallback( (val: ParamValue) => { @@ -84,7 +84,7 @@ export const useURLState = ( if (debugLog === true) { console.log('useURLState setParam', param, val); } - setState(state => ({ ...state, [param]: val })); + setState(state => ({...state, [param]: val})); let encodedVal = val; if (typeof val === 'string') { @@ -92,7 +92,7 @@ export const useURLState = ( } navigateTo( window.location.pathname, - sanitize({ ...getQueryParamsFromURL(), [param]: encodedVal }, defaultValues), + sanitize({...getQueryParamsFromURL(), [param]: encodedVal}, defaultValues), { replace: true, } @@ -139,7 +139,7 @@ type ParamValueSetterCustom = (val: T) => void; export const useURLStateCustom = ( param: string, - { parse, stringify, ..._options }: Options & OptionsCustom + {parse, stringify, ..._options}: Options & OptionsCustom ): [T, ParamValueSetterCustom] => { const [urlValue, setURLValue] = useURLState(param, _options); @@ -163,6 +163,6 @@ export const JSONSerializer = (val: object): string => { export const JSONParser = (val: ParamValue): T => { return JSON.parse(val as string); -} +}; export default URLStateContext; diff --git a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx index afe564b9c21..f52faefd147 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/DashboardItems/index.tsx @@ -11,15 +11,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Profiler, ProfilerOnRenderCallback } from 'react'; +import {Profiler, ProfilerOnRenderCallback} from 'react'; -import { ConditionalWrapper } from '@parca/components'; +import {ConditionalWrapper} from '@parca/components'; import Callgraph from '../../../Callgraph'; import ProfileIcicleGraph from '../../../ProfileIcicleGraph'; -import { ProfileSource } from '../../../ProfileSource'; -import { SourceView } from '../../../SourceView'; -import { Table } from '../../../Table'; +import {CurrentPathFrame} from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; +import {ProfileSource} from '../../../ProfileSource'; +import {SourceView} from '../../../SourceView'; +import {Table} from '../../../Table'; import type { CallgraphData, FlamegraphData, @@ -27,7 +28,6 @@ import type { TopTableData, VisualizationType, } from '../../types/visualization'; -import { CurrentPathFrame } from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; interface GetDashboardItemProps { type: VisualizationType; @@ -82,7 +82,7 @@ export const getDashboardItem = ({ WrapperComponent={Profiler} wrapperProps={{ id: 'icicleGraph', - onRender: perf?.onRender ?? (() => { }), + onRender: perf?.onRender ?? (() => {}), }} > { }} + setNewCurPath={() => {}} curPathArrow={[]} - setNewCurPathArrow={() => { }} + setNewCurPathArrow={() => {}} arrow={flamechartData?.arrow} total={total} filtered={filtered} diff --git a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx index 1e6e6035ebc..59948bed63e 100644 --- a/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx +++ b/ui/packages/shared/profile/src/ProfileView/components/Toolbars/index.tsx @@ -11,16 +11,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { FC } from 'react'; +import {FC} from 'react'; -import { Icon } from '@iconify/react'; +import {Icon} from '@iconify/react'; -import { QueryServiceClient } from '@parca/client'; -import { Button, UserPreferencesModal } from '@parca/components'; -import { ProfileType } from '@parca/parser'; +import {QueryServiceClient} from '@parca/client'; +import {Button, UserPreferencesModal} from '@parca/components'; +import {ProfileType} from '@parca/parser'; -import { ProfileSource } from '../../../ProfileSource'; -import { useDashboard } from '../../context/DashboardContext'; +import {CurrentPathFrame} from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; +import {ProfileSource} from '../../../ProfileSource'; +import {useDashboard} from '../../context/DashboardContext'; import GroupByDropdown from '../ActionButtons/GroupByDropdown'; import SortByDropdown from '../ActionButtons/SortByDropdown'; import FilterByFunctionButton from '../FilterByFunctionButton'; @@ -28,7 +29,6 @@ import ShareButton from '../ShareButton'; import ViewSelector from '../ViewSelector'; import MultiLevelDropdown from './MultiLevelDropdown'; import TableColumnsDropdown from './TableColumnsDropdown'; -import { CurrentPathFrame } from '../../../ProfileIcicleGraph/IcicleGraphArrow/utils'; export interface VisualisationToolbarProps { groupBy: string[]; @@ -91,7 +91,7 @@ export const TableToolbar: FC = ({ ); }; -export const IcicleGraphToolbar: FC = ({ curPath, setNewCurPath }) => { +export const IcicleGraphToolbar: FC = ({curPath, setNewCurPath}) => { return ( <>
@@ -134,7 +134,7 @@ export const VisualisationToolbar: FC = ({ clearSelection, showVisualizationSelector = true, }) => { - const { dashboardItems } = useDashboard(); + const {dashboardItems} = useDashboard(); const isTableViz = dashboardItems?.includes('table'); const isGraphViz = dashboardItems?.includes('icicle'); @@ -150,7 +150,7 @@ export const VisualisationToolbar: FC = ({ labels={groupByLabels} setGroupByLabels={setGroupByLabels} /> - { }} /> + {}} /> diff --git a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts index 3ef287c9fb5..3a899502324 100644 --- a/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts +++ b/ui/packages/shared/profile/src/ProfileView/hooks/useVisualizationState.ts @@ -16,7 +16,7 @@ import {useCallback, useState} from 'react'; import {JSONParser, JSONSerializer, useURLState, useURLStateCustom} from '@parca/components'; import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow'; -import { CurrentPathFrame } from '../../ProfileIcicleGraph/IcicleGraphArrow/utils'; +import {CurrentPathFrame} from '../../ProfileIcicleGraph/IcicleGraphArrow/utils'; export const useVisualizationState = (): { curPath: string[]; From 8ce22a537eddf95d9cac20fd68f67d9d2ed083f4 Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Tue, 8 Apr 2025 11:53:25 +0530 Subject: [PATCH 09/11] Fix lint error --- ui/packages/shared/components/src/hooks/URLState/index.tsx | 2 +- .../profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/packages/shared/components/src/hooks/URLState/index.tsx b/ui/packages/shared/components/src/hooks/URLState/index.tsx index acf4ce7da5a..060ccb9b97b 100644 --- a/ui/packages/shared/components/src/hooks/URLState/index.tsx +++ b/ui/packages/shared/components/src/hooks/URLState/index.tsx @@ -161,7 +161,7 @@ export const JSONSerializer = (val: object): string => { return JSON.stringify(val, (_, v) => (typeof v === 'bigint' ? v.toString() : v)); }; -export const JSONParser = (val: ParamValue): T => { +export const JSONParser = (val: ParamValue): T => { return JSON.parse(val as string); }; diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts index 763bb1db48d..c167efcd0fb 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts @@ -162,7 +162,7 @@ export interface CurrentPathFrame { export const getCurrentPathFrameData = ( table: Table, row: number, - level: number + _level: number ): CurrentPathFrame => { const functionName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); const systemName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); From 1000addadc427f3b3736fc338637099b205967ba Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Tue, 8 Apr 2025 12:02:04 +0530 Subject: [PATCH 10/11] Fixed missing address field --- .../src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts index c167efcd0fb..c81c911a4b7 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts @@ -30,6 +30,7 @@ import { FIELD_LABELS_ONLY, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE, + FIELD_FUNCTION_START_LINE, } from './index'; export function nodeLabel( @@ -156,6 +157,7 @@ export interface CurrentPathFrame { systemName: string; fileName: string; lineNumber: number; + address: string; inlined: boolean; } @@ -167,7 +169,9 @@ export const getCurrentPathFrameData = ( const functionName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); const systemName: string | null = arrowToString(table.getChild(FIELD_FUNCTION_NAME)?.get(row)); const fileName: string | null = arrowToString(table.getChild(FIELD_MAPPING_FILE)?.get(row)); - const lineNumber: bigint = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n; + const lineNumber: bigint = table.getChild(FIELD_FUNCTION_START_LINE)?.get(row) ?? 0n; + const addressBigInt: bigint = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row); + const address = hexifyAddress(addressBigInt); const inlined: boolean | null = table.getChild(FIELD_INLINED)?.get(row); return { @@ -175,6 +179,7 @@ export const getCurrentPathFrameData = ( systemName: systemName ?? '', fileName: fileName ?? '', lineNumber: Number(lineNumber), + address: address, inlined: inlined ?? false, }; }; @@ -191,6 +196,7 @@ export function isCurrentPathFrameMatch( a.systemName === b.systemName && a.fileName === b.fileName && a.lineNumber === b.lineNumber && + a.address === b.address && a.inlined === b.inlined ); } From 576b720a37883fd8fce7ee25e492d03c4ee753b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 10:58:34 +0000 Subject: [PATCH 11/11] [pre-commit.ci lite] apply automatic fixes --- .../profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts index c81c911a4b7..c443093ffeb 100644 --- a/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +++ b/ui/packages/shared/profile/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts @@ -26,11 +26,11 @@ import {MergedProfileSource, ProfileSource} from '../../ProfileSource'; import {BigIntDuo, hexifyAddress} from '../../utils'; import { FIELD_FUNCTION_NAME, + FIELD_FUNCTION_START_LINE, FIELD_INLINED, FIELD_LABELS_ONLY, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE, - FIELD_FUNCTION_START_LINE, } from './index'; export function nodeLabel(