@parca/profile 0.16.187 → 0.16.189
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 +8 -0
- package/dist/ProfileIcicleGraph/index.d.ts +1 -2
- package/dist/ProfileIcicleGraph/index.js +1 -8
- package/dist/ProfileView/index.d.ts +1 -3
- package/dist/ProfileView/index.js +2 -2
- package/dist/ProfileViewWithData.js +10 -15
- package/package.json +7 -7
- package/src/ProfileIcicleGraph/index.tsx +0 -9
- package/src/ProfileView/index.tsx +1 -4
- package/src/ProfileViewWithData.tsx +10 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.16.189 (2023-06-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## 0.16.188 (2023-06-21)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.16.187](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.186...@parca/profile@0.16.187) (2023-06-20)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -9,10 +9,9 @@ interface ProfileIcicleGraphProps {
|
|
|
9
9
|
sampleUnit: string;
|
|
10
10
|
curPath: string[] | [];
|
|
11
11
|
setNewCurPath: (path: string[]) => void;
|
|
12
|
-
onContainerResize?: ResizeHandler;
|
|
13
12
|
navigateTo?: NavigateFunction;
|
|
14
13
|
loading: boolean;
|
|
15
14
|
setActionButtons?: (buttons: JSX.Element) => void;
|
|
16
15
|
}
|
|
17
|
-
declare const ProfileIcicleGraph: ({ graph, total, filtered, curPath, setNewCurPath, sampleUnit,
|
|
16
|
+
declare const ProfileIcicleGraph: ({ graph, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, }: ProfileIcicleGraphProps) => JSX.Element;
|
|
18
17
|
export default ProfileIcicleGraph;
|
|
@@ -18,16 +18,9 @@ import { divide, selectQueryParam } from '@parca/utilities';
|
|
|
18
18
|
import DiffLegend from '../components/DiffLegend';
|
|
19
19
|
import { IcicleGraph } from './IcicleGraph';
|
|
20
20
|
const numberFormatter = new Intl.NumberFormat('en-US');
|
|
21
|
-
const ProfileIcicleGraph = ({ graph, total, filtered, curPath, setNewCurPath, sampleUnit,
|
|
21
|
+
const ProfileIcicleGraph = ({ graph, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, }) => {
|
|
22
22
|
const compareMode = selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
|
|
23
23
|
const { ref, dimensions } = useContainerDimensions();
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (dimensions === undefined)
|
|
26
|
-
return;
|
|
27
|
-
if (onContainerResize === undefined)
|
|
28
|
-
return;
|
|
29
|
-
onContainerResize(dimensions.width, dimensions.height);
|
|
30
|
-
}, [dimensions, onContainerResize]);
|
|
31
24
|
const [totalFormatted, totalUnfilteredFormatted, isTrimmed, trimmedFormatted, trimmedPercentage, isFiltered, filteredPercentage,] = useMemo(() => {
|
|
32
25
|
if (graph === undefined) {
|
|
33
26
|
return ['0', '0', false, '0', '0', false, '0', '0'];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Callgraph as CallgraphType, Flamegraph, QueryServiceClient, Top } from '@parca/client';
|
|
2
|
-
import { ResizeHandler } from '../ProfileIcicleGraph';
|
|
3
2
|
import { ProfileSource } from '../ProfileSource';
|
|
4
3
|
type NavigateFunction = (path: string, queryParams: any, options?: {
|
|
5
4
|
replace?: boolean;
|
|
@@ -37,8 +36,7 @@ export interface ProfileViewProps {
|
|
|
37
36
|
navigateTo?: NavigateFunction;
|
|
38
37
|
compare?: boolean;
|
|
39
38
|
onDownloadPProf: () => void;
|
|
40
|
-
onFlamegraphContainerResize?: ResizeHandler;
|
|
41
39
|
pprofDownloading?: boolean;
|
|
42
40
|
}
|
|
43
|
-
export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf,
|
|
41
|
+
export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf, pprofDownloading, }: ProfileViewProps) => JSX.Element;
|
|
44
42
|
export {};
|
|
@@ -36,7 +36,7 @@ function arrayEquals(a, b) {
|
|
|
36
36
|
a.length === b.length &&
|
|
37
37
|
a.every((val, index) => val === b[index]));
|
|
38
38
|
}
|
|
39
|
-
export const ProfileView = ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf,
|
|
39
|
+
export const ProfileView = ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf, pprofDownloading, }) => {
|
|
40
40
|
const { ref, dimensions } = useContainerDimensions();
|
|
41
41
|
const [curPath, setCurPath] = useState([]);
|
|
42
42
|
const [rawDashboardItems, setDashboardItems] = useURLState({
|
|
@@ -127,7 +127,7 @@ export const ProfileView = ({ total, filtered, flamegraphData, topTableData, cal
|
|
|
127
127
|
return flamegraphData?.data != null ? (_jsx(ConditionalWrapper, { condition: perf?.onRender != null, WrapperComponent: Profiler, wrapperProps: {
|
|
128
128
|
id: 'icicleGraph',
|
|
129
129
|
onRender: perf?.onRender,
|
|
130
|
-
}, children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, graph: flamegraphData.data, total: total, filtered: filtered, sampleUnit: sampleUnit,
|
|
130
|
+
}, children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, graph: flamegraphData.data, total: total, filtered: filtered, sampleUnit: sampleUnit, navigateTo: navigateTo, loading: flamegraphData.loading, setActionButtons: setActionButtons }) })) : (_jsx(_Fragment, { children: " " }));
|
|
131
131
|
}
|
|
132
132
|
case 'callgraph': {
|
|
133
133
|
return callgraphData?.data !== undefined &&
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { useEffect, useState } from 'react';
|
|
14
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
15
15
|
import { QueryRequest_ReportType } from '@parca/client';
|
|
16
16
|
import { useGrpcMetadata, useParcaContext, useURLState } from '@parca/components';
|
|
17
17
|
import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
|
|
@@ -22,24 +22,19 @@ import { downloadPprof } from './utils';
|
|
|
22
22
|
export const ProfileViewWithData = ({ queryClient, profileSource, navigateTo, }) => {
|
|
23
23
|
const metadata = useGrpcMetadata();
|
|
24
24
|
const [dashboardItems] = useURLState({ param: 'dashboard_items', navigateTo });
|
|
25
|
-
const [nodeTrimThreshold, setNodeTrimThreshold] = useState(0);
|
|
26
25
|
const [enableTrimming] = useUserPreference(USER_PREFERENCES.ENABLE_GRAPH_TRIMMING.key);
|
|
27
26
|
const [pprofDownloading, setPprofDownloading] = useState(false);
|
|
28
|
-
|
|
27
|
+
const nodeTrimThreshold = useMemo(() => {
|
|
29
28
|
if (!enableTrimming) {
|
|
30
|
-
|
|
29
|
+
return 0;
|
|
31
30
|
}
|
|
31
|
+
let width =
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
33
|
+
window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
34
|
+
// subtract the padding
|
|
35
|
+
width = width - 12 - 16 - 12;
|
|
36
|
+
return (1 / width) * 100;
|
|
32
37
|
}, [enableTrimming]);
|
|
33
|
-
const onFlamegraphContainerResize = (width) => {
|
|
34
|
-
if (!enableTrimming || width === 0) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const threshold = (1 / width) * 100;
|
|
38
|
-
if (threshold === nodeTrimThreshold) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
setNodeTrimThreshold(threshold);
|
|
42
|
-
};
|
|
43
38
|
const { isLoading: flamegraphLoading, response: flamegraphResponse, error: flamegraphError, } = useQuery(queryClient, profileSource, QueryRequest_ReportType.FLAMEGRAPH_TABLE, {
|
|
44
39
|
skip: !dashboardItems.includes('icicle'),
|
|
45
40
|
nodeTrimThreshold,
|
|
@@ -120,6 +115,6 @@ export const ProfileViewWithData = ({ queryClient, profileSource, navigateTo, })
|
|
|
120
115
|
? callgraphResponse?.report?.callgraph
|
|
121
116
|
: undefined,
|
|
122
117
|
error: callgraphError,
|
|
123
|
-
}, sampleUnit: sampleUnit, profileSource: profileSource, queryClient: queryClient, navigateTo: navigateTo, onDownloadPProf: () => void downloadPProfClick(), pprofDownloading: pprofDownloading
|
|
118
|
+
}, sampleUnit: sampleUnit, profileSource: profileSource, queryClient: queryClient, navigateTo: navigateTo, onDownloadPProf: () => void downloadPProfClick(), pprofDownloading: pprofDownloading }));
|
|
124
119
|
};
|
|
125
120
|
export default ProfileViewWithData;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.189",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@parca/client": "^0.16.
|
|
7
|
-
"@parca/components": "^0.16.
|
|
6
|
+
"@parca/client": "^0.16.75",
|
|
7
|
+
"@parca/components": "^0.16.150",
|
|
8
8
|
"@parca/dynamicsize": "^0.16.54",
|
|
9
|
-
"@parca/hooks": "^0.0.
|
|
9
|
+
"@parca/hooks": "^0.0.10",
|
|
10
10
|
"@parca/parser": "^0.16.55",
|
|
11
|
-
"@parca/store": "^0.16.
|
|
12
|
-
"@parca/utilities": "^0.0.
|
|
11
|
+
"@parca/store": "^0.16.80",
|
|
12
|
+
"@parca/utilities": "^0.0.10",
|
|
13
13
|
"@tanstack/react-query": "^4.0.5",
|
|
14
14
|
"@types/react-beautiful-dnd": "^13.1.3",
|
|
15
15
|
"d3": "7.8.5",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public",
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "523b2f51ae6a88257c502df6c7bfd34522ae15cf"
|
|
50
50
|
}
|
|
@@ -33,7 +33,6 @@ interface ProfileIcicleGraphProps {
|
|
|
33
33
|
sampleUnit: string;
|
|
34
34
|
curPath: string[] | [];
|
|
35
35
|
setNewCurPath: (path: string[]) => void;
|
|
36
|
-
onContainerResize?: ResizeHandler;
|
|
37
36
|
navigateTo?: NavigateFunction;
|
|
38
37
|
loading: boolean;
|
|
39
38
|
setActionButtons?: (buttons: JSX.Element) => void;
|
|
@@ -46,7 +45,6 @@ const ProfileIcicleGraph = ({
|
|
|
46
45
|
curPath,
|
|
47
46
|
setNewCurPath,
|
|
48
47
|
sampleUnit,
|
|
49
|
-
onContainerResize,
|
|
50
48
|
navigateTo,
|
|
51
49
|
loading,
|
|
52
50
|
setActionButtons,
|
|
@@ -55,13 +53,6 @@ const ProfileIcicleGraph = ({
|
|
|
55
53
|
selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
|
|
56
54
|
const {ref, dimensions} = useContainerDimensions();
|
|
57
55
|
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (dimensions === undefined) return;
|
|
60
|
-
if (onContainerResize === undefined) return;
|
|
61
|
-
|
|
62
|
-
onContainerResize(dimensions.width, dimensions.height);
|
|
63
|
-
}, [dimensions, onContainerResize]);
|
|
64
|
-
|
|
65
56
|
const [
|
|
66
57
|
totalFormatted,
|
|
67
58
|
totalUnfilteredFormatted,
|
|
@@ -39,7 +39,7 @@ import {getNewSpanColor} from '@parca/utilities';
|
|
|
39
39
|
|
|
40
40
|
import {Callgraph} from '../';
|
|
41
41
|
import {jsonToDot} from '../Callgraph/utils';
|
|
42
|
-
import ProfileIcicleGraph
|
|
42
|
+
import ProfileIcicleGraph from '../ProfileIcicleGraph';
|
|
43
43
|
import {ProfileSource} from '../ProfileSource';
|
|
44
44
|
import {TopTable} from '../TopTable';
|
|
45
45
|
import ProfileShareButton from '../components/ProfileShareButton';
|
|
@@ -86,7 +86,6 @@ export interface ProfileViewProps {
|
|
|
86
86
|
navigateTo?: NavigateFunction;
|
|
87
87
|
compare?: boolean;
|
|
88
88
|
onDownloadPProf: () => void;
|
|
89
|
-
onFlamegraphContainerResize?: ResizeHandler;
|
|
90
89
|
pprofDownloading?: boolean;
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -110,7 +109,6 @@ export const ProfileView = ({
|
|
|
110
109
|
queryClient,
|
|
111
110
|
navigateTo,
|
|
112
111
|
onDownloadPProf,
|
|
113
|
-
onFlamegraphContainerResize,
|
|
114
112
|
pprofDownloading,
|
|
115
113
|
}: ProfileViewProps): JSX.Element => {
|
|
116
114
|
const {ref, dimensions} = useContainerDimensions();
|
|
@@ -248,7 +246,6 @@ export const ProfileView = ({
|
|
|
248
246
|
total={total}
|
|
249
247
|
filtered={filtered}
|
|
250
248
|
sampleUnit={sampleUnit}
|
|
251
|
-
onContainerResize={onFlamegraphContainerResize}
|
|
252
249
|
navigateTo={navigateTo}
|
|
253
250
|
loading={flamegraphData.loading}
|
|
254
251
|
setActionButtons={setActionButtons}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
-
import {useEffect, useState} from 'react';
|
|
14
|
+
import {useEffect, useMemo, useState} from 'react';
|
|
15
15
|
|
|
16
16
|
import {QueryRequest_ReportType, QueryServiceClient} from '@parca/client';
|
|
17
17
|
import {useGrpcMetadata, useParcaContext, useURLState} from '@parca/components';
|
|
@@ -37,26 +37,21 @@ export const ProfileViewWithData = ({
|
|
|
37
37
|
}: ProfileViewWithDataProps): JSX.Element => {
|
|
38
38
|
const metadata = useGrpcMetadata();
|
|
39
39
|
const [dashboardItems] = useURLState({param: 'dashboard_items', navigateTo});
|
|
40
|
-
const [nodeTrimThreshold, setNodeTrimThreshold] = useState<number>(0);
|
|
41
40
|
const [enableTrimming] = useUserPreference<boolean>(USER_PREFERENCES.ENABLE_GRAPH_TRIMMING.key);
|
|
42
41
|
const [pprofDownloading, setPprofDownloading] = useState<boolean>(false);
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
const nodeTrimThreshold = useMemo(() => {
|
|
45
44
|
if (!enableTrimming) {
|
|
46
|
-
|
|
45
|
+
return 0;
|
|
47
46
|
}
|
|
48
|
-
}, [enableTrimming]);
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
setNodeTrimThreshold(threshold);
|
|
59
|
-
};
|
|
48
|
+
let width =
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
50
|
+
window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
51
|
+
// subtract the padding
|
|
52
|
+
width = width - 12 - 16 - 12;
|
|
53
|
+
return (1 / width) * 100;
|
|
54
|
+
}, [enableTrimming]);
|
|
60
55
|
|
|
61
56
|
const {
|
|
62
57
|
isLoading: flamegraphLoading,
|
|
@@ -173,7 +168,6 @@ export const ProfileViewWithData = ({
|
|
|
173
168
|
navigateTo={navigateTo}
|
|
174
169
|
onDownloadPProf={() => void downloadPProfClick()}
|
|
175
170
|
pprofDownloading={pprofDownloading}
|
|
176
|
-
onFlamegraphContainerResize={onFlamegraphContainerResize}
|
|
177
171
|
/>
|
|
178
172
|
);
|
|
179
173
|
};
|