@parca/profile 0.19.52 → 0.19.53
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/ProfileExplorer/index.js +3 -3
- package/dist/ProfileView/components/DashboardItems/index.d.ts +0 -2
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +10 -4
- package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts +2 -0
- package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -0
- package/dist/ProfileView/hooks/{useResetStateOnNewSearch.js → useResetFlameGraphState.js} +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +0 -2
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +5 -5
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +1 -3
- package/dist/ProfileViewWithData.js +1 -1
- package/package.json +2 -2
- package/src/ProfileExplorer/index.tsx +3 -3
- package/src/ProfileView/components/DashboardItems/index.tsx +0 -2
- package/src/ProfileView/components/ProfileFilters/useProfileFilters.ts +10 -4
- package/src/ProfileView/hooks/{useResetStateOnNewSearch.ts → useResetFlameGraphState.ts} +1 -1
- package/src/ProfileView/hooks/useVisualizationState.ts +6 -7
- package/src/ProfileView/index.tsx +0 -4
- package/src/ProfileViewWithData.tsx +1 -1
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts +0 -2
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.19.53](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.52...@parca/profile@0.19.53) (2025-09-15)
|
|
7
|
+
|
|
8
|
+
## 0.24.2 (2025-09-10)
|
|
9
|
+
|
|
10
|
+
**Note:** Version bump only for package @parca/profile
|
|
11
|
+
|
|
6
12
|
## 0.19.52 (2025-09-15)
|
|
7
13
|
|
|
8
14
|
## 0.24.2 (2025-09-10)
|
|
@@ -19,7 +19,7 @@ import { createStore } from '@parca/store';
|
|
|
19
19
|
import { capitalizeOnlyFirstLetter, safeDecode } from '@parca/utilities';
|
|
20
20
|
import { ProfileSelectionFromParams, SuffixParams } from '..';
|
|
21
21
|
import { useProfileTypes } from '../ProfileSelector';
|
|
22
|
-
import {
|
|
22
|
+
import { useResetFlameGraphState } from '../ProfileView/hooks/useResetFlameGraphState';
|
|
23
23
|
import { useResetStateOnProfileTypeChange } from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
24
24
|
import { sumByToParam, useSumByFromParams } from '../useSumBy';
|
|
25
25
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
@@ -89,7 +89,7 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
|
89
89
|
const [profileA, setProfileA] = useState(null);
|
|
90
90
|
const [profileB, setProfileB] = useState(null);
|
|
91
91
|
const resetStateOnProfileTypeChange = useResetStateOnProfileTypeChange();
|
|
92
|
-
const
|
|
92
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
93
93
|
const sumByA = useSumByFromParams(sum_by_a);
|
|
94
94
|
const sumByB = useSumByFromParams(sum_by_b);
|
|
95
95
|
useEffect(() => {
|
|
@@ -156,7 +156,7 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
158
|
// Reset the state when a new search is performed.
|
|
159
|
-
|
|
159
|
+
resetFlameGraphState();
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
const mergeParams = q.mergeFrom !== undefined && q.mergeTo !== undefined
|
|
@@ -15,8 +15,6 @@ interface GetDashboardItemProps {
|
|
|
15
15
|
profileSource: ProfileSource;
|
|
16
16
|
total: bigint;
|
|
17
17
|
filtered: bigint;
|
|
18
|
-
curPath: string[];
|
|
19
|
-
setNewCurPath: (path: string[]) => void;
|
|
20
18
|
curPathArrow: CurrentPathFrame[];
|
|
21
19
|
setNewCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
22
20
|
perf?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/DashboardItems/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAW,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAIrD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,UAAU,qBAAqB;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/DashboardItems/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAW,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAIrD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,UAAU,qBAAqB;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,kBAAkB,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IACvD,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,wBAAwB,CAAC;KACrC,CAAC;IACF,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,eAAO,MAAM,gBAAgB,GAAI,qLAe9B,qBAAqB,KAAG,GAAG,CAAC,OA+F9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfileFilters.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ProfileFilters/useProfileFilters.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,KAAK,MAAM,EAA6C,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"useProfileFilters.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ProfileFilters/useProfileFilters.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,KAAK,MAAM,EAA6C,MAAM,eAAe,CAAC;AAMtF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;IAC5F,SAAS,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,cAAc,CAAC;IAChE,KAAK,EAAE,MAAM,CAAC;CACf;AAqBD,eAAO,MAAM,uBAAuB,GAAI,cAAc,MAAM,EAAE,KAAG,aAAa,EA+E7E,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,aAAa,EAAE,KAAG,MAAM,EAmF7E,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO;IACnC,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,mBAAmB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACpE,YAAY,EAAE,MAAM,IAAI,CAAC;CA2L1B,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { useResetFlameGraphState } from '../../hooks/useResetFlameGraphState';
|
|
14
15
|
import { getPresetByKey, isPresetKey } from './filterPresets';
|
|
15
16
|
import { useProfileFiltersUrlState } from './useProfileFiltersUrlState';
|
|
16
17
|
const createStringCondition = (matchType, value) => ({
|
|
@@ -182,6 +183,7 @@ export const convertToProtoFilters = (profileFilters) => {
|
|
|
182
183
|
};
|
|
183
184
|
export const useProfileFilters = () => {
|
|
184
185
|
const { appliedFilters, setAppliedFilters } = useProfileFiltersUrlState();
|
|
186
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
185
187
|
const [localFilters, setLocalFilters] = useState(appliedFilters ?? []);
|
|
186
188
|
const lastAppliedFiltersRef = useRef([]);
|
|
187
189
|
const localFiltersRef = useRef(localFilters);
|
|
@@ -259,9 +261,10 @@ export const useProfileFilters = () => {
|
|
|
259
261
|
// Auto-apply the filter since it has a value
|
|
260
262
|
const filtersToApply = [...(appliedFilters ?? []), newFilter];
|
|
261
263
|
setAppliedFilters(filtersToApply);
|
|
264
|
+
resetFlameGraphState();
|
|
262
265
|
},
|
|
263
266
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
264
|
-
[setAppliedFilters]);
|
|
267
|
+
[setAppliedFilters, resetFlameGraphState]);
|
|
265
268
|
const removeExcludeBinary = useCallback((binaryName) => {
|
|
266
269
|
// Search for the exclude filter (not_contains) for this binary
|
|
267
270
|
const filterToRemove = (appliedFilters ?? []).find(f => f.type === 'frame' &&
|
|
@@ -272,10 +275,11 @@ export const useProfileFilters = () => {
|
|
|
272
275
|
// Remove the filter from applied filters
|
|
273
276
|
const updatedAppliedFilters = (appliedFilters ?? []).filter(f => f.id !== filterToRemove.id);
|
|
274
277
|
setAppliedFilters(updatedAppliedFilters);
|
|
278
|
+
resetFlameGraphState();
|
|
275
279
|
// Also remove from local filters
|
|
276
280
|
setLocalFilters(localFiltersRef.current.filter(f => f.id !== filterToRemove.id));
|
|
277
281
|
}
|
|
278
|
-
}, [appliedFilters, setAppliedFilters]);
|
|
282
|
+
}, [appliedFilters, setAppliedFilters, resetFlameGraphState]);
|
|
279
283
|
const removeFilter = useCallback((id) => {
|
|
280
284
|
setLocalFilters(localFiltersRef.current.filter(f => f.id !== id));
|
|
281
285
|
}, []);
|
|
@@ -285,7 +289,8 @@ export const useProfileFilters = () => {
|
|
|
285
289
|
const resetFilters = useCallback(() => {
|
|
286
290
|
setLocalFilters([]);
|
|
287
291
|
setAppliedFilters([]);
|
|
288
|
-
|
|
292
|
+
resetFlameGraphState();
|
|
293
|
+
}, [setAppliedFilters, resetFlameGraphState]);
|
|
289
294
|
const onApplyFilters = useCallback(() => {
|
|
290
295
|
const validFilters = localFiltersRef.current.filter(f => {
|
|
291
296
|
// For preset filters, only need type and value
|
|
@@ -300,7 +305,8 @@ export const useProfileFilters = () => {
|
|
|
300
305
|
id: `filter-${Date.now()}-${index}`,
|
|
301
306
|
}));
|
|
302
307
|
setAppliedFilters(filtersToApply);
|
|
303
|
-
|
|
308
|
+
resetFlameGraphState();
|
|
309
|
+
}, [setAppliedFilters, resetFlameGraphState]);
|
|
304
310
|
const protoFilters = useMemo(() => {
|
|
305
311
|
return convertToProtoFilters(appliedFilters ?? []);
|
|
306
312
|
}, [appliedFilters]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResetFlameGraphState.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetFlameGraphState.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,uBAAuB,QAAO,CAAC,MAAM,IAAI,CAWrD,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useURLState } from '@parca/components';
|
|
14
|
-
export const
|
|
14
|
+
export const useResetFlameGraphState = () => {
|
|
15
15
|
const [val, setCurPath] = useURLState('cur_path');
|
|
16
16
|
return () => {
|
|
17
17
|
setTimeout(() => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CurrentPathFrame } from '../../ProfileFlameGraph/FlameGraphArrow/utils';
|
|
2
2
|
export declare const useVisualizationState: () => {
|
|
3
|
-
curPath: string[];
|
|
4
|
-
setCurPath: (path: string[]) => void;
|
|
5
3
|
curPathArrow: CurrentPathFrame[];
|
|
6
4
|
setCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
7
5
|
colorStackLegend: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisualizationState.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useVisualizationState.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAC,gBAAgB,EAAC,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"useVisualizationState.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useVisualizationState.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAC,gBAAgB,EAAC,MAAM,+CAA+C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,QAAO;IACvC,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,eAAe,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IACpD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,uBAAuB,EAAE,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5E,yBAAyB,EAAE,MAAM,IAAI,CAAC;CA0EvC,CAAC"}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { useCallback, useMemo
|
|
13
|
+
import { useCallback, useMemo } from 'react';
|
|
14
14
|
import { JSONParser, JSONSerializer, useURLState, useURLStateCustom } from '@parca/components';
|
|
15
15
|
import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_NAME, FIELD_LABELS, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE, } from '../../ProfileFlameGraph/FlameGraphArrow';
|
|
16
|
+
import { useResetFlameGraphState } from './useResetFlameGraphState';
|
|
16
17
|
export const useVisualizationState = () => {
|
|
17
|
-
const [curPath, setCurPath] = useState([]);
|
|
18
18
|
const [curPathArrow, setCurPathArrow] = useURLStateCustom('cur_path', {
|
|
19
19
|
parse: (JSONParser),
|
|
20
20
|
stringify: JSONSerializer,
|
|
@@ -27,6 +27,7 @@ export const useVisualizationState = () => {
|
|
|
27
27
|
alwaysReturnArray: true,
|
|
28
28
|
});
|
|
29
29
|
const [sandwichFunctionName, setSandwichFunctionName] = useURLState('sandwich_function_name');
|
|
30
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
30
31
|
const levelsOfProfiling = useMemo(() => [
|
|
31
32
|
FIELD_FUNCTION_NAME,
|
|
32
33
|
FIELD_FUNCTION_FILE_NAME,
|
|
@@ -44,7 +45,8 @@ export const useVisualizationState = () => {
|
|
|
44
45
|
const filteredGroupBy = groupBy.filter(item => !levelsOfProfiling.includes(item));
|
|
45
46
|
setGroupBy([...filteredGroupBy, key]); // add
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
resetFlameGraphState();
|
|
49
|
+
}, [groupBy, setGroupBy, levelsOfProfiling, resetFlameGraphState]);
|
|
48
50
|
const setGroupByLabels = useCallback((labels) => {
|
|
49
51
|
setGroupBy(groupBy.filter(l => !l.startsWith(`${FIELD_LABELS}.`)).concat(labels));
|
|
50
52
|
}, [groupBy, setGroupBy]);
|
|
@@ -52,8 +54,6 @@ export const useVisualizationState = () => {
|
|
|
52
54
|
setSandwichFunctionName(undefined);
|
|
53
55
|
}, [setSandwichFunctionName]);
|
|
54
56
|
return {
|
|
55
|
-
curPath,
|
|
56
|
-
setCurPath,
|
|
57
57
|
curPathArrow,
|
|
58
58
|
setCurPathArrow,
|
|
59
59
|
colorStackLegend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileView/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAC,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAE/E,eAAO,MAAM,WAAW,GAAI,iMAczB,gBAAgB,KAAG,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileView/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAC,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAE/E,eAAO,MAAM,WAAW,GAAI,iMAczB,gBAAgB,KAAG,GAAG,CAAC,OA2HzB,CAAC"}
|
|
@@ -26,7 +26,7 @@ import { useVisualizationState } from './hooks/useVisualizationState';
|
|
|
26
26
|
export const ProfileView = ({ total, filtered, flamegraphData, flamechartData, topTableData, sourceData, profileSource, queryClient, onDownloadPProf, pprofDownloading, compare, showVisualizationSelector, sandwichData, }) => {
|
|
27
27
|
const { timezone, perf, profileViewExternalMainActions, preferencesModal, profileViewExternalSubActions, } = useParcaContext();
|
|
28
28
|
const { ref, dimensions } = useContainerDimensions();
|
|
29
|
-
const {
|
|
29
|
+
const { curPathArrow, setCurPathArrow, colorStackLegend, colorBy, groupBy, toggleGroupBy, setGroupByLabels, sandwichFunctionName, resetSandwichFunctionName, } = useVisualizationState();
|
|
30
30
|
const { colorMappings } = useProfileMetadata({
|
|
31
31
|
flamegraphArrow: flamegraphData.arrow,
|
|
32
32
|
metadataMappingFiles: flamegraphData.metadataMappingFiles,
|
|
@@ -49,8 +49,6 @@ export const ProfileView = ({ total, filtered, flamegraphData, flamechartData, t
|
|
|
49
49
|
profileSource,
|
|
50
50
|
total,
|
|
51
51
|
filtered,
|
|
52
|
-
curPath,
|
|
53
|
-
setNewCurPath: setCurPath,
|
|
54
52
|
curPathArrow,
|
|
55
53
|
setNewCurPathArrow: setCurPathArrow,
|
|
56
54
|
perf,
|
|
@@ -39,7 +39,7 @@ export const ProfileViewWithData = ({ queryClient, profileSource, showVisualizat
|
|
|
39
39
|
const { protoFilters } = useProfileFilters();
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
// If profile type is not delta, remove flamechart from the dashboard items
|
|
42
|
-
// and set it to flame if no other items are selected.
|
|
42
|
+
// and set it to flame graph if no other items are selected.
|
|
43
43
|
if (profileSource == null) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.53",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"access": "public",
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "364f74584252524568010bb27636fdb87fe7aee7"
|
|
83
83
|
}
|
|
@@ -23,7 +23,7 @@ import {capitalizeOnlyFirstLetter, safeDecode, type NavigateFunction} from '@par
|
|
|
23
23
|
|
|
24
24
|
import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
|
|
25
25
|
import {QuerySelection, useProfileTypes} from '../ProfileSelector';
|
|
26
|
-
import {
|
|
26
|
+
import {useResetFlameGraphState} from '../ProfileView/hooks/useResetFlameGraphState';
|
|
27
27
|
import {useResetStateOnProfileTypeChange} from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
28
28
|
import {sumByToParam, useSumByFromParams} from '../useSumBy';
|
|
29
29
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
@@ -162,7 +162,7 @@ const ProfileExplorerApp = ({
|
|
|
162
162
|
const [profileB, setProfileB] = useState<ProfileSelection | null>(null);
|
|
163
163
|
|
|
164
164
|
const resetStateOnProfileTypeChange = useResetStateOnProfileTypeChange();
|
|
165
|
-
const
|
|
165
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
166
166
|
|
|
167
167
|
const sumByA = useSumByFromParams(sum_by_a);
|
|
168
168
|
const sumByB = useSumByFromParams(sum_by_b);
|
|
@@ -250,7 +250,7 @@ const ProfileExplorerApp = ({
|
|
|
250
250
|
resetStateOnProfileTypeChange();
|
|
251
251
|
} else {
|
|
252
252
|
// Reset the state when a new search is performed.
|
|
253
|
-
|
|
253
|
+
resetFlameGraphState();
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -42,8 +42,6 @@ interface GetDashboardItemProps {
|
|
|
42
42
|
profileSource: ProfileSource;
|
|
43
43
|
total: bigint;
|
|
44
44
|
filtered: bigint;
|
|
45
|
-
curPath: string[];
|
|
46
|
-
setNewCurPath: (path: string[]) => void;
|
|
47
45
|
curPathArrow: CurrentPathFrame[];
|
|
48
46
|
setNewCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
49
47
|
perf?: {
|
|
@@ -15,6 +15,7 @@ import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
|
15
15
|
|
|
16
16
|
import {type Filter, type NumberCondition, type StringCondition} from '@parca/client';
|
|
17
17
|
|
|
18
|
+
import {useResetFlameGraphState} from '../../hooks/useResetFlameGraphState';
|
|
18
19
|
import {getPresetByKey, isPresetKey} from './filterPresets';
|
|
19
20
|
import {useProfileFiltersUrlState} from './useProfileFiltersUrlState';
|
|
20
21
|
|
|
@@ -226,6 +227,7 @@ export const useProfileFilters = (): {
|
|
|
226
227
|
resetFilters: () => void;
|
|
227
228
|
} => {
|
|
228
229
|
const {appliedFilters, setAppliedFilters} = useProfileFiltersUrlState();
|
|
230
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
229
231
|
|
|
230
232
|
const [localFilters, setLocalFilters] = useState<ProfileFilter[]>(appliedFilters ?? []);
|
|
231
233
|
|
|
@@ -327,9 +329,10 @@ export const useProfileFilters = (): {
|
|
|
327
329
|
// Auto-apply the filter since it has a value
|
|
328
330
|
const filtersToApply = [...(appliedFilters ?? []), newFilter];
|
|
329
331
|
setAppliedFilters(filtersToApply);
|
|
332
|
+
resetFlameGraphState();
|
|
330
333
|
},
|
|
331
334
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
332
|
-
[setAppliedFilters]
|
|
335
|
+
[setAppliedFilters, resetFlameGraphState]
|
|
333
336
|
);
|
|
334
337
|
|
|
335
338
|
const removeExcludeBinary = useCallback(
|
|
@@ -349,12 +352,13 @@ export const useProfileFilters = (): {
|
|
|
349
352
|
f => f.id !== filterToRemove.id
|
|
350
353
|
);
|
|
351
354
|
setAppliedFilters(updatedAppliedFilters);
|
|
355
|
+
resetFlameGraphState();
|
|
352
356
|
|
|
353
357
|
// Also remove from local filters
|
|
354
358
|
setLocalFilters(localFiltersRef.current.filter(f => f.id !== filterToRemove.id));
|
|
355
359
|
}
|
|
356
360
|
},
|
|
357
|
-
[appliedFilters, setAppliedFilters]
|
|
361
|
+
[appliedFilters, setAppliedFilters, resetFlameGraphState]
|
|
358
362
|
);
|
|
359
363
|
|
|
360
364
|
const removeFilter = useCallback((id: string) => {
|
|
@@ -368,7 +372,8 @@ export const useProfileFilters = (): {
|
|
|
368
372
|
const resetFilters = useCallback(() => {
|
|
369
373
|
setLocalFilters([]);
|
|
370
374
|
setAppliedFilters([]);
|
|
371
|
-
|
|
375
|
+
resetFlameGraphState();
|
|
376
|
+
}, [setAppliedFilters, resetFlameGraphState]);
|
|
372
377
|
|
|
373
378
|
const onApplyFilters = useCallback((): void => {
|
|
374
379
|
const validFilters = localFiltersRef.current.filter(f => {
|
|
@@ -386,7 +391,8 @@ export const useProfileFilters = (): {
|
|
|
386
391
|
}));
|
|
387
392
|
|
|
388
393
|
setAppliedFilters(filtersToApply);
|
|
389
|
-
|
|
394
|
+
resetFlameGraphState();
|
|
395
|
+
}, [setAppliedFilters, resetFlameGraphState]);
|
|
390
396
|
|
|
391
397
|
const protoFilters = useMemo(() => {
|
|
392
398
|
return convertToProtoFilters(appliedFilters ?? []);
|
|
@@ -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 {useCallback, useMemo
|
|
14
|
+
import {useCallback, useMemo} from 'react';
|
|
15
15
|
|
|
16
16
|
import {JSONParser, JSONSerializer, useURLState, useURLStateCustom} from '@parca/components';
|
|
17
17
|
|
|
@@ -23,10 +23,9 @@ import {
|
|
|
23
23
|
FIELD_MAPPING_FILE,
|
|
24
24
|
} from '../../ProfileFlameGraph/FlameGraphArrow';
|
|
25
25
|
import {CurrentPathFrame} from '../../ProfileFlameGraph/FlameGraphArrow/utils';
|
|
26
|
+
import {useResetFlameGraphState} from './useResetFlameGraphState';
|
|
26
27
|
|
|
27
28
|
export const useVisualizationState = (): {
|
|
28
|
-
curPath: string[];
|
|
29
|
-
setCurPath: (path: string[]) => void;
|
|
30
29
|
curPathArrow: CurrentPathFrame[];
|
|
31
30
|
setCurPathArrow: (path: CurrentPathFrame[]) => void;
|
|
32
31
|
colorStackLegend: string | undefined;
|
|
@@ -40,7 +39,6 @@ export const useVisualizationState = (): {
|
|
|
40
39
|
setSandwichFunctionName: (sandwichFunctionName: string | undefined) => void;
|
|
41
40
|
resetSandwichFunctionName: () => void;
|
|
42
41
|
} => {
|
|
43
|
-
const [curPath, setCurPath] = useState<string[]>([]);
|
|
44
42
|
const [curPathArrow, setCurPathArrow] = useURLStateCustom<CurrentPathFrame[]>('cur_path', {
|
|
45
43
|
parse: JSONParser<CurrentPathFrame[]>,
|
|
46
44
|
stringify: JSONSerializer,
|
|
@@ -55,6 +53,7 @@ export const useVisualizationState = (): {
|
|
|
55
53
|
const [sandwichFunctionName, setSandwichFunctionName] = useURLState<string | undefined>(
|
|
56
54
|
'sandwich_function_name'
|
|
57
55
|
);
|
|
56
|
+
const resetFlameGraphState = useResetFlameGraphState();
|
|
58
57
|
|
|
59
58
|
const levelsOfProfiling = useMemo(
|
|
60
59
|
() => [
|
|
@@ -81,8 +80,10 @@ export const useVisualizationState = (): {
|
|
|
81
80
|
const filteredGroupBy = groupBy.filter(item => !levelsOfProfiling.includes(item));
|
|
82
81
|
setGroupBy([...filteredGroupBy, key]); // add
|
|
83
82
|
}
|
|
83
|
+
|
|
84
|
+
resetFlameGraphState();
|
|
84
85
|
},
|
|
85
|
-
[groupBy, setGroupBy, levelsOfProfiling]
|
|
86
|
+
[groupBy, setGroupBy, levelsOfProfiling, resetFlameGraphState]
|
|
86
87
|
);
|
|
87
88
|
|
|
88
89
|
const setGroupByLabels = useCallback(
|
|
@@ -97,8 +98,6 @@ export const useVisualizationState = (): {
|
|
|
97
98
|
}, [setSandwichFunctionName]);
|
|
98
99
|
|
|
99
100
|
return {
|
|
100
|
-
curPath,
|
|
101
|
-
setCurPath,
|
|
102
101
|
curPathArrow,
|
|
103
102
|
setCurPathArrow,
|
|
104
103
|
colorStackLegend,
|
|
@@ -56,8 +56,6 @@ export const ProfileView = ({
|
|
|
56
56
|
const {ref, dimensions} = useContainerDimensions();
|
|
57
57
|
|
|
58
58
|
const {
|
|
59
|
-
curPath,
|
|
60
|
-
setCurPath,
|
|
61
59
|
curPathArrow,
|
|
62
60
|
setCurPathArrow,
|
|
63
61
|
colorStackLegend,
|
|
@@ -100,8 +98,6 @@ export const ProfileView = ({
|
|
|
100
98
|
profileSource,
|
|
101
99
|
total,
|
|
102
100
|
filtered,
|
|
103
|
-
curPath,
|
|
104
|
-
setNewCurPath: setCurPath,
|
|
105
101
|
curPathArrow,
|
|
106
102
|
setNewCurPathArrow: setCurPathArrow,
|
|
107
103
|
perf,
|
|
@@ -58,7 +58,7 @@ export const ProfileViewWithData = ({
|
|
|
58
58
|
|
|
59
59
|
useEffect(() => {
|
|
60
60
|
// If profile type is not delta, remove flamechart from the dashboard items
|
|
61
|
-
// and set it to flame if no other items are selected.
|
|
61
|
+
// and set it to flame graph if no other items are selected.
|
|
62
62
|
if (profileSource == null) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useResetStateOnNewSearch.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetStateOnNewSearch.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,QAAO,CAAC,MAAM,IAAI,CAWtD,CAAC"}
|