@parca/profile 0.18.4 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/GraphTooltipArrow/useGraphTooltip/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +6 -3
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts +2 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.js +13 -3
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts +1 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts +4 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.js +15 -6
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.js +5 -4
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts +2 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.js +3 -2
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts +3 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +4 -4
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.js +1 -1
- package/dist/ProfileIcicleGraph/index.d.ts +4 -1
- package/dist/ProfileIcicleGraph/index.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/index.js +22 -6
- package/dist/ProfileView/components/DashboardItems/index.d.ts +3 -1
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
- package/dist/ProfileView/components/DashboardItems/index.js +4 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +0 -13
- package/dist/ProfileView/components/Toolbars/index.d.ts +8 -0
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +6 -2
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts +1 -0
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +1 -1
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/index.js +9 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +4 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +9 -1
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +3 -2
- package/dist/ProfileView/types/visualization.d.ts +1 -1
- package/dist/ProfileView/types/visualization.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +1 -1
- package/dist/Sandwich/components/CalleesSection.d.ts +25 -0
- package/dist/Sandwich/components/CalleesSection.d.ts.map +1 -0
- package/dist/Sandwich/components/CalleesSection.js +11 -0
- package/dist/Sandwich/components/CallersSection.d.ts +25 -0
- package/dist/Sandwich/components/CallersSection.d.ts.map +1 -0
- package/dist/Sandwich/components/CallersSection.js +11 -0
- package/dist/Sandwich/components/TableSection.d.ts +21 -0
- package/dist/Sandwich/components/TableSection.d.ts.map +1 -0
- package/dist/Sandwich/components/TableSection.js +7 -0
- package/dist/Sandwich/index.d.ts +19 -0
- package/dist/Sandwich/index.d.ts.map +1 -0
- package/dist/Sandwich/index.js +182 -0
- package/dist/Sandwich/utils/processRowData.d.ts +11 -0
- package/dist/Sandwich/utils/processRowData.d.ts.map +1 -0
- package/dist/Sandwich/utils/processRowData.js +53 -0
- package/dist/Table/ColorCell.d.ts +7 -0
- package/dist/Table/ColorCell.d.ts.map +1 -0
- package/dist/Table/ColorCell.js +2 -0
- package/dist/Table/MoreDropdown.d.ts +5 -0
- package/dist/Table/MoreDropdown.d.ts.map +1 -0
- package/dist/Table/MoreDropdown.js +39 -0
- package/dist/Table/hooks/useColorManagement.d.ts +14 -0
- package/dist/Table/hooks/useColorManagement.d.ts.map +1 -0
- package/dist/Table/hooks/useColorManagement.js +32 -0
- package/dist/Table/hooks/useTableConfiguration.d.ts +21 -0
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -0
- package/dist/Table/hooks/useTableConfiguration.js +204 -0
- package/dist/Table/index.d.ts +14 -4
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +34 -332
- package/dist/Table/utils/functions.d.ts +1 -0
- package/dist/Table/utils/functions.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/useQuery.d.ts +1 -0
- package/dist/useQuery.d.ts.map +1 -1
- package/dist/useQuery.js +7 -1
- package/package.json +7 -7
- package/src/GraphTooltipArrow/useGraphTooltip/index.ts +6 -3
- package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +23 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.tsx +1 -0
- package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +34 -5
- package/src/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.tsx +6 -4
- package/src/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.tsx +5 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +13 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +1 -1
- package/src/ProfileIcicleGraph/index.tsx +50 -18
- package/src/ProfileView/components/DashboardItems/index.tsx +21 -0
- package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +11 -25
- package/src/ProfileView/components/Toolbars/index.tsx +42 -1
- package/src/ProfileView/components/ViewSelector/Dropdown.tsx +2 -1
- package/src/ProfileView/components/ViewSelector/index.tsx +11 -0
- package/src/ProfileView/hooks/useVisualizationState.ts +16 -1
- package/src/ProfileView/index.tsx +7 -0
- package/src/ProfileView/types/visualization.ts +7 -1
- package/src/ProfileViewWithData.tsx +1 -1
- package/src/Sandwich/components/CalleesSection.tsx +87 -0
- package/src/Sandwich/components/CallersSection.tsx +88 -0
- package/src/Sandwich/components/TableSection.tsx +67 -0
- package/src/Sandwich/index.tsx +342 -0
- package/src/Sandwich/utils/processRowData.ts +78 -0
- package/src/Table/ColorCell.tsx +26 -0
- package/src/Table/MoreDropdown.tsx +75 -0
- package/src/Table/hooks/useColorManagement.ts +58 -0
- package/src/Table/hooks/useTableConfiguration.tsx +237 -0
- package/src/Table/index.tsx +37 -470
- package/src/Table/utils/functions.ts +1 -0
- package/src/useQuery.tsx +10 -1
|
@@ -50,6 +50,9 @@ export interface VisualisationToolbarProps {
|
|
|
50
50
|
clearSelection: () => void;
|
|
51
51
|
setGroupByLabels: (labels: string[]) => void;
|
|
52
52
|
showVisualizationSelector?: boolean;
|
|
53
|
+
sandwichFunctionName?: string;
|
|
54
|
+
setSandwichFunctionName: (sandwichFunctionName: string | undefined) => void;
|
|
55
|
+
resetSandwichFunctionName: () => void;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export interface TableToolbarProps {
|
|
@@ -65,6 +68,11 @@ export interface IcicleGraphToolbarProps {
|
|
|
65
68
|
setNewCurPath: (path: CurrentPathFrame[]) => void;
|
|
66
69
|
}
|
|
67
70
|
|
|
71
|
+
export interface SandwichIcicleGraphToolbarProps {
|
|
72
|
+
resetSandwichFunctionName: () => void;
|
|
73
|
+
sandwichFunctionName?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
export const TableToolbar: FC<TableToolbarProps> = ({
|
|
69
77
|
profileType,
|
|
70
78
|
total,
|
|
@@ -76,6 +84,7 @@ export const TableToolbar: FC<TableToolbarProps> = ({
|
|
|
76
84
|
<>
|
|
77
85
|
<div className="flex w-full gap-2 items-end">
|
|
78
86
|
<TableColumnsDropdown profileType={profileType} total={total} filtered={filtered} />
|
|
87
|
+
|
|
79
88
|
<Button
|
|
80
89
|
color="neutral"
|
|
81
90
|
onClick={clearSelection}
|
|
@@ -108,6 +117,27 @@ export const IcicleGraphToolbar: FC<IcicleGraphToolbarProps> = ({curPath, setNew
|
|
|
108
117
|
);
|
|
109
118
|
};
|
|
110
119
|
|
|
120
|
+
export const SandwichIcicleGraphToolbar: FC<SandwichIcicleGraphToolbarProps> = ({
|
|
121
|
+
resetSandwichFunctionName,
|
|
122
|
+
sandwichFunctionName,
|
|
123
|
+
}) => {
|
|
124
|
+
return (
|
|
125
|
+
<>
|
|
126
|
+
<div className="flex w-full gap-2 items-end justify-between">
|
|
127
|
+
<Button
|
|
128
|
+
color="neutral"
|
|
129
|
+
onClick={() => resetSandwichFunctionName()}
|
|
130
|
+
className="w-auto"
|
|
131
|
+
variant="neutral"
|
|
132
|
+
disabled={sandwichFunctionName === undefined || sandwichFunctionName.length === 0}
|
|
133
|
+
>
|
|
134
|
+
Reset view
|
|
135
|
+
</Button>
|
|
136
|
+
</div>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
111
141
|
const Divider = (): JSX.Element => (
|
|
112
142
|
<div className="border-t mt-4 border-gray-200 dark:border-gray-700 h-[1px] w-full pb-4" />
|
|
113
143
|
);
|
|
@@ -131,12 +161,14 @@ export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
|
|
|
131
161
|
currentSearchString,
|
|
132
162
|
clearSelection,
|
|
133
163
|
showVisualizationSelector = true,
|
|
164
|
+
resetSandwichFunctionName,
|
|
165
|
+
sandwichFunctionName,
|
|
134
166
|
}) => {
|
|
135
167
|
const {dashboardItems} = useDashboard();
|
|
136
168
|
|
|
137
169
|
const isTableViz = dashboardItems?.includes('table');
|
|
138
170
|
const isGraphViz = dashboardItems?.includes('icicle');
|
|
139
|
-
|
|
171
|
+
const isSandwichIcicleGraphViz = dashboardItems?.includes('sandwich');
|
|
140
172
|
const req = profileSource?.QueryRequest();
|
|
141
173
|
if (req !== null && req !== undefined) {
|
|
142
174
|
req.groupBy = {
|
|
@@ -193,6 +225,15 @@ export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
|
|
|
193
225
|
/>
|
|
194
226
|
</>
|
|
195
227
|
)}
|
|
228
|
+
{isSandwichIcicleGraphViz && (
|
|
229
|
+
<>
|
|
230
|
+
<Divider />
|
|
231
|
+
<SandwichIcicleGraphToolbar
|
|
232
|
+
resetSandwichFunctionName={resetSandwichFunctionName}
|
|
233
|
+
sandwichFunctionName={sandwichFunctionName}
|
|
234
|
+
/>
|
|
235
|
+
</>
|
|
236
|
+
)}
|
|
196
237
|
</>
|
|
197
238
|
);
|
|
198
239
|
};
|
|
@@ -36,6 +36,7 @@ export interface DropdownItem {
|
|
|
36
36
|
export interface InnerAction {
|
|
37
37
|
text: string;
|
|
38
38
|
onClick: () => void;
|
|
39
|
+
isDisabled?: boolean;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function contructItemsFromArray(items: any[]): DropdownItem[] {
|
|
@@ -173,7 +174,7 @@ const DropdownOption = ({option}: {option: DropdownItem}): JSX.Element => {
|
|
|
173
174
|
e.stopPropagation();
|
|
174
175
|
option.innerAction?.onClick();
|
|
175
176
|
}}
|
|
176
|
-
disabled={disabled}
|
|
177
|
+
disabled={disabled || option.innerAction.isDisabled}
|
|
177
178
|
>
|
|
178
179
|
{option.innerAction.text}
|
|
179
180
|
{option.innerAction.text === 'Add Panel' && (
|
|
@@ -43,6 +43,7 @@ const ViewSelector = ({profileSource}: Props): JSX.Element => {
|
|
|
43
43
|
}> = [
|
|
44
44
|
{key: 'table', label: 'Table', canBeSelected: !dashboardItems.includes('table')},
|
|
45
45
|
{key: 'icicle', label: 'icicle', canBeSelected: !dashboardItems.includes('icicle')},
|
|
46
|
+
{key: 'sandwich', label: 'sandwich', canBeSelected: !dashboardItems.includes('sandwich')},
|
|
46
47
|
];
|
|
47
48
|
if (enableicicleCharts) {
|
|
48
49
|
allItems.push({
|
|
@@ -96,6 +97,16 @@ const ViewSelector = ({profileSource}: Props): JSX.Element => {
|
|
|
96
97
|
canBeSelected: boolean;
|
|
97
98
|
}): InnerAction | undefined => {
|
|
98
99
|
if (dashboardItems.length === 1 && item.key === dashboardItems[0]) return undefined;
|
|
100
|
+
|
|
101
|
+
// For sandwich view, return a no-op action
|
|
102
|
+
if (item.key === 'sandwich') {
|
|
103
|
+
return {
|
|
104
|
+
text: 'Add Panel',
|
|
105
|
+
onClick: () => {},
|
|
106
|
+
isDisabled: true, // Custom property to control button state
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
99
110
|
return {
|
|
100
111
|
text:
|
|
101
112
|
!item.canBeSelected && item.key === 'source'
|
|
@@ -27,11 +27,15 @@ export const useVisualizationState = (): {
|
|
|
27
27
|
setSearchString: (searchString: string | undefined) => void;
|
|
28
28
|
colorStackLegend: string | undefined;
|
|
29
29
|
colorBy: string;
|
|
30
|
+
setColorBy: (colorBy: string) => void;
|
|
30
31
|
groupBy: string[];
|
|
31
32
|
setGroupBy: (keys: string[]) => void;
|
|
32
33
|
toggleGroupBy: (key: string) => void;
|
|
33
34
|
clearSelection: () => void;
|
|
34
35
|
setGroupByLabels: (labels: string[]) => void;
|
|
36
|
+
sandwichFunctionName: string | undefined;
|
|
37
|
+
setSandwichFunctionName: (sandwichFunctionName: string | undefined) => void;
|
|
38
|
+
resetSandwichFunctionName: () => void;
|
|
35
39
|
} => {
|
|
36
40
|
const [curPath, setCurPath] = useState<string[]>([]);
|
|
37
41
|
const [curPathArrow, setCurPathArrow] = useURLStateCustom<CurrentPathFrame[]>('cur_path', {
|
|
@@ -41,11 +45,14 @@ export const useVisualizationState = (): {
|
|
|
41
45
|
});
|
|
42
46
|
const [currentSearchString, setSearchString] = useURLState<string | undefined>('search_string');
|
|
43
47
|
const [colorStackLegend] = useURLState<string | undefined>('color_stack_legend');
|
|
44
|
-
const [colorBy] = useURLState('color_by');
|
|
48
|
+
const [colorBy, setColorBy] = useURLState('color_by');
|
|
45
49
|
const [groupBy, setStoreGroupBy] = useURLState<string[]>('group_by', {
|
|
46
50
|
defaultValue: [FIELD_FUNCTION_NAME],
|
|
47
51
|
alwaysReturnArray: true,
|
|
48
52
|
});
|
|
53
|
+
const [sandwichFunctionName, setSandwichFunctionName] = useURLState<string | undefined>(
|
|
54
|
+
'sandwich_function_name'
|
|
55
|
+
);
|
|
49
56
|
|
|
50
57
|
const setGroupBy = useCallback(
|
|
51
58
|
(keys: string[]): void => {
|
|
@@ -74,6 +81,10 @@ export const useVisualizationState = (): {
|
|
|
74
81
|
setSearchString?.('');
|
|
75
82
|
}, [setSearchString]);
|
|
76
83
|
|
|
84
|
+
const resetSandwichFunctionName = useCallback((): void => {
|
|
85
|
+
setSandwichFunctionName(undefined);
|
|
86
|
+
}, [setSandwichFunctionName]);
|
|
87
|
+
|
|
77
88
|
return {
|
|
78
89
|
curPath,
|
|
79
90
|
setCurPath,
|
|
@@ -83,10 +94,14 @@ export const useVisualizationState = (): {
|
|
|
83
94
|
setSearchString,
|
|
84
95
|
colorStackLegend,
|
|
85
96
|
colorBy: (colorBy as string) ?? '',
|
|
97
|
+
setColorBy,
|
|
86
98
|
groupBy,
|
|
87
99
|
setGroupBy,
|
|
88
100
|
toggleGroupBy,
|
|
89
101
|
setGroupByLabels,
|
|
90
102
|
clearSelection,
|
|
103
|
+
sandwichFunctionName,
|
|
104
|
+
setSandwichFunctionName,
|
|
105
|
+
resetSandwichFunctionName,
|
|
91
106
|
};
|
|
92
107
|
};
|
|
@@ -62,6 +62,9 @@ export const ProfileView = ({
|
|
|
62
62
|
toggleGroupBy,
|
|
63
63
|
clearSelection,
|
|
64
64
|
setGroupByLabels,
|
|
65
|
+
sandwichFunctionName,
|
|
66
|
+
setSandwichFunctionName,
|
|
67
|
+
resetSandwichFunctionName,
|
|
65
68
|
} = useVisualizationState();
|
|
66
69
|
|
|
67
70
|
const {colorMappings} = useProfileMetadata({
|
|
@@ -101,6 +104,7 @@ export const ProfileView = ({
|
|
|
101
104
|
currentSearchString,
|
|
102
105
|
setSearchString,
|
|
103
106
|
perf,
|
|
107
|
+
queryClient,
|
|
104
108
|
});
|
|
105
109
|
};
|
|
106
110
|
|
|
@@ -149,6 +153,9 @@ export const ProfileView = ({
|
|
|
149
153
|
clearSelection={clearSelection}
|
|
150
154
|
setGroupByLabels={setGroupByLabels}
|
|
151
155
|
showVisualizationSelector={showVisualizationSelector}
|
|
156
|
+
sandwichFunctionName={sandwichFunctionName}
|
|
157
|
+
setSandwichFunctionName={setSandwichFunctionName}
|
|
158
|
+
resetSandwichFunctionName={resetSandwichFunctionName}
|
|
152
159
|
/>
|
|
153
160
|
|
|
154
161
|
{isColorStackLegendEnabled && (
|
|
@@ -57,7 +57,13 @@ export interface SourceData {
|
|
|
57
57
|
error?: any;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export type VisualizationType =
|
|
60
|
+
export type VisualizationType =
|
|
61
|
+
| 'icicle'
|
|
62
|
+
| 'callgraph'
|
|
63
|
+
| 'table'
|
|
64
|
+
| 'source'
|
|
65
|
+
| 'iciclechart'
|
|
66
|
+
| 'sandwich';
|
|
61
67
|
|
|
62
68
|
export interface ProfileViewProps {
|
|
63
69
|
total: bigint;
|
|
@@ -129,7 +129,7 @@ export const ProfileViewWithData = ({
|
|
|
129
129
|
response: tableResponse,
|
|
130
130
|
error: tableError,
|
|
131
131
|
} = useQuery(queryClient, profileSource, QueryRequest_ReportType.TABLE_ARROW, {
|
|
132
|
-
skip: !dashboardItems.includes('table'),
|
|
132
|
+
skip: !dashboardItems.includes('table') && !dashboardItems.includes('sandwich'),
|
|
133
133
|
binaryFrameFilter,
|
|
134
134
|
});
|
|
135
135
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
import {type FlamegraphArrow} from '@parca/client';
|
|
17
|
+
|
|
18
|
+
import ProfileIcicleGraph from '../../ProfileIcicleGraph';
|
|
19
|
+
import {type CurrentPathFrame} from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
|
|
20
|
+
import {type ProfileSource} from '../../ProfileSource';
|
|
21
|
+
|
|
22
|
+
interface CalleesSectionProps {
|
|
23
|
+
calleesRef: React.RefObject<HTMLDivElement>;
|
|
24
|
+
isHalfScreen: boolean;
|
|
25
|
+
calleesFlamegraphResponse?: {
|
|
26
|
+
report: {
|
|
27
|
+
oneofKind: string;
|
|
28
|
+
flamegraphArrow?: FlamegraphArrow;
|
|
29
|
+
};
|
|
30
|
+
total?: string;
|
|
31
|
+
};
|
|
32
|
+
calleesFlamegraphLoading: boolean;
|
|
33
|
+
calleesFlamegraphError: any;
|
|
34
|
+
filtered: bigint;
|
|
35
|
+
profileSource: ProfileSource;
|
|
36
|
+
curPathArrow: CurrentPathFrame[];
|
|
37
|
+
setCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
38
|
+
metadataMappingFiles?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function CalleesSection({
|
|
42
|
+
calleesRef,
|
|
43
|
+
isHalfScreen,
|
|
44
|
+
calleesFlamegraphResponse,
|
|
45
|
+
calleesFlamegraphLoading,
|
|
46
|
+
calleesFlamegraphError,
|
|
47
|
+
filtered,
|
|
48
|
+
profileSource,
|
|
49
|
+
curPathArrow,
|
|
50
|
+
setCurPathArrow,
|
|
51
|
+
metadataMappingFiles,
|
|
52
|
+
}: CalleesSectionProps): JSX.Element {
|
|
53
|
+
return (
|
|
54
|
+
<div className="flex relative items-start flex-row" ref={calleesRef}>
|
|
55
|
+
<div className="[writing-mode:vertical-lr] -rotate-180 px-1 uppercase text-[10px] text-left">
|
|
56
|
+
{'<-'} Callees
|
|
57
|
+
</div>
|
|
58
|
+
<ProfileIcicleGraph
|
|
59
|
+
arrow={
|
|
60
|
+
calleesFlamegraphResponse?.report.oneofKind === 'flamegraphArrow'
|
|
61
|
+
? calleesFlamegraphResponse?.report?.flamegraphArrow
|
|
62
|
+
: undefined
|
|
63
|
+
}
|
|
64
|
+
total={BigInt(calleesFlamegraphResponse?.total ?? '0')}
|
|
65
|
+
filtered={filtered}
|
|
66
|
+
profileType={profileSource?.ProfileType()}
|
|
67
|
+
loading={calleesFlamegraphLoading}
|
|
68
|
+
error={calleesFlamegraphError}
|
|
69
|
+
isHalfScreen={true}
|
|
70
|
+
width={
|
|
71
|
+
calleesRef.current != null
|
|
72
|
+
? isHalfScreen
|
|
73
|
+
? (calleesRef.current.getBoundingClientRect().width - 54) / 2
|
|
74
|
+
: calleesRef.current.getBoundingClientRect().width - 16
|
|
75
|
+
: 0
|
|
76
|
+
}
|
|
77
|
+
metadataMappingFiles={metadataMappingFiles}
|
|
78
|
+
metadataLoading={false}
|
|
79
|
+
isSandwichIcicleGraph={true}
|
|
80
|
+
curPathArrow={curPathArrow}
|
|
81
|
+
setNewCurPathArrow={setCurPathArrow}
|
|
82
|
+
profileSource={profileSource}
|
|
83
|
+
tooltipId="callees"
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
import {type FlamegraphArrow} from '@parca/client';
|
|
17
|
+
|
|
18
|
+
import ProfileIcicleGraph from '../../ProfileIcicleGraph';
|
|
19
|
+
import {type CurrentPathFrame} from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
|
|
20
|
+
import {type ProfileSource} from '../../ProfileSource';
|
|
21
|
+
|
|
22
|
+
interface CallersSectionProps {
|
|
23
|
+
callersRef: React.RefObject<HTMLDivElement>;
|
|
24
|
+
isHalfScreen: boolean;
|
|
25
|
+
callersFlamegraphResponse?: {
|
|
26
|
+
report: {
|
|
27
|
+
oneofKind: string;
|
|
28
|
+
flamegraphArrow?: FlamegraphArrow;
|
|
29
|
+
};
|
|
30
|
+
total?: string;
|
|
31
|
+
};
|
|
32
|
+
callersFlamegraphLoading: boolean;
|
|
33
|
+
callersFlamegraphError: any;
|
|
34
|
+
filtered: bigint;
|
|
35
|
+
profileSource: ProfileSource;
|
|
36
|
+
curPathArrow: CurrentPathFrame[];
|
|
37
|
+
setCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
38
|
+
metadataMappingFiles?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function CallersSection({
|
|
42
|
+
callersRef,
|
|
43
|
+
isHalfScreen,
|
|
44
|
+
callersFlamegraphResponse,
|
|
45
|
+
callersFlamegraphLoading,
|
|
46
|
+
callersFlamegraphError,
|
|
47
|
+
filtered,
|
|
48
|
+
profileSource,
|
|
49
|
+
curPathArrow,
|
|
50
|
+
setCurPathArrow,
|
|
51
|
+
metadataMappingFiles,
|
|
52
|
+
}: CallersSectionProps): JSX.Element {
|
|
53
|
+
return (
|
|
54
|
+
<div className="flex relative flex-row" ref={callersRef}>
|
|
55
|
+
<div className="[writing-mode:vertical-lr] -rotate-180 px-1 uppercase text-[10px] text-left">
|
|
56
|
+
Callers {'->'}
|
|
57
|
+
</div>
|
|
58
|
+
<ProfileIcicleGraph
|
|
59
|
+
arrow={
|
|
60
|
+
callersFlamegraphResponse?.report.oneofKind === 'flamegraphArrow'
|
|
61
|
+
? callersFlamegraphResponse?.report?.flamegraphArrow
|
|
62
|
+
: undefined
|
|
63
|
+
}
|
|
64
|
+
total={BigInt(callersFlamegraphResponse?.total ?? '0')}
|
|
65
|
+
filtered={filtered}
|
|
66
|
+
profileType={profileSource?.ProfileType()}
|
|
67
|
+
loading={callersFlamegraphLoading}
|
|
68
|
+
error={callersFlamegraphError}
|
|
69
|
+
isHalfScreen={true}
|
|
70
|
+
width={
|
|
71
|
+
callersRef.current != null
|
|
72
|
+
? isHalfScreen
|
|
73
|
+
? (callersRef.current.getBoundingClientRect().width - 54) / 2
|
|
74
|
+
: callersRef.current.getBoundingClientRect().width - 16
|
|
75
|
+
: 0
|
|
76
|
+
}
|
|
77
|
+
metadataMappingFiles={metadataMappingFiles}
|
|
78
|
+
metadataLoading={false}
|
|
79
|
+
isSandwichIcicleGraph={true}
|
|
80
|
+
curPathArrow={curPathArrow}
|
|
81
|
+
setNewCurPathArrow={setCurPathArrow}
|
|
82
|
+
isFlamegraph={true}
|
|
83
|
+
profileSource={profileSource}
|
|
84
|
+
tooltipId="callers"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
|
|
14
|
+
import {type ColumnDef, type Row as RowType} from '@tanstack/table-core';
|
|
15
|
+
|
|
16
|
+
import {Table as TableComponent} from '@parca/components';
|
|
17
|
+
|
|
18
|
+
import {type Row} from '../../Table';
|
|
19
|
+
import {ColumnName, DataRow, ROW_HEIGHT} from '../../Table/utils/functions';
|
|
20
|
+
|
|
21
|
+
interface TableSectionProps {
|
|
22
|
+
rows: Row[];
|
|
23
|
+
columns: Array<ColumnDef<Row>>;
|
|
24
|
+
initialSorting: Array<{id: string; desc: boolean}>;
|
|
25
|
+
selectedRow: RowType<Row> | null;
|
|
26
|
+
onRowClick: (row: DataRow) => void;
|
|
27
|
+
shouldHighlightRow: (row: Row) => boolean;
|
|
28
|
+
enableHighlighting: boolean;
|
|
29
|
+
columnVisibility: Record<ColumnName, boolean>;
|
|
30
|
+
height?: number;
|
|
31
|
+
sandwichFunctionName?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function TableSection({
|
|
35
|
+
rows,
|
|
36
|
+
columns,
|
|
37
|
+
initialSorting,
|
|
38
|
+
selectedRow,
|
|
39
|
+
onRowClick,
|
|
40
|
+
shouldHighlightRow,
|
|
41
|
+
enableHighlighting,
|
|
42
|
+
columnVisibility,
|
|
43
|
+
height,
|
|
44
|
+
sandwichFunctionName,
|
|
45
|
+
}: TableSectionProps): JSX.Element {
|
|
46
|
+
console.log(height);
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
style={{height: height !== undefined ? `${height}px` : '80vh'}}
|
|
50
|
+
className={`font-robotoMono w-full cursor-pointer ${
|
|
51
|
+
selectedRow != null && sandwichFunctionName !== undefined ? 'w-[50%]' : ''
|
|
52
|
+
}`}
|
|
53
|
+
>
|
|
54
|
+
<TableComponent
|
|
55
|
+
data={rows}
|
|
56
|
+
columns={columns}
|
|
57
|
+
initialSorting={initialSorting}
|
|
58
|
+
usePointerCursor={true}
|
|
59
|
+
onRowClick={onRowClick}
|
|
60
|
+
shouldHighlightRow={shouldHighlightRow}
|
|
61
|
+
enableHighlighting={enableHighlighting}
|
|
62
|
+
estimatedRowHeight={ROW_HEIGHT}
|
|
63
|
+
columnVisibility={columnVisibility}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|