@parca/profile 0.19.52 → 0.19.54

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/MatchersInput/index.js +3 -3
  3. package/dist/MetricsGraph/MetricsContextMenu/index.js +2 -2
  4. package/dist/MetricsGraph/MetricsTooltip/index.js +2 -2
  5. package/dist/MetricsGraph/index.js +2 -2
  6. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  7. package/dist/ProfileExplorer/ProfileExplorerCompare.js +2 -2
  8. package/dist/ProfileExplorer/index.js +3 -3
  9. package/dist/ProfileFlameGraph/index.js +2 -2
  10. package/dist/ProfileMetricsGraph/index.js +3 -3
  11. package/dist/ProfileSelector/QueryControls.js +6 -6
  12. package/dist/ProfileTypeSelector/index.js +2 -2
  13. package/dist/ProfileView/components/DashboardItems/index.d.ts +0 -2
  14. package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
  15. package/dist/ProfileView/components/DiffLegend.js +2 -2
  16. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +3 -3
  17. package/dist/ProfileView/components/ProfileFilters/index.js +6 -6
  18. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts.map +1 -1
  19. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +10 -4
  20. package/dist/ProfileView/components/Toolbars/index.js +2 -2
  21. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts +2 -0
  22. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -0
  23. package/dist/ProfileView/hooks/{useResetStateOnNewSearch.js → useResetFlameGraphState.js} +1 -1
  24. package/dist/ProfileView/hooks/useVisualizationState.d.ts +0 -2
  25. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  26. package/dist/ProfileView/hooks/useVisualizationState.js +5 -5
  27. package/dist/ProfileView/index.d.ts.map +1 -1
  28. package/dist/ProfileView/index.js +1 -3
  29. package/dist/ProfileViewWithData.js +1 -1
  30. package/dist/SimpleMatchers/index.js +3 -3
  31. package/dist/ViewMatchers/index.js +2 -2
  32. package/package.json +4 -4
  33. package/src/MatchersInput/index.tsx +3 -3
  34. package/src/MetricsGraph/MetricsContextMenu/index.tsx +2 -2
  35. package/src/MetricsGraph/MetricsTooltip/index.tsx +2 -2
  36. package/src/MetricsGraph/index.tsx +2 -2
  37. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +11 -5
  38. package/src/ProfileExplorer/index.tsx +3 -3
  39. package/src/ProfileFlameGraph/index.tsx +2 -2
  40. package/src/ProfileMetricsGraph/index.tsx +4 -4
  41. package/src/ProfileSelector/QueryControls.tsx +13 -13
  42. package/src/ProfileTypeSelector/index.tsx +2 -2
  43. package/src/ProfileView/components/DashboardItems/index.tsx +0 -2
  44. package/src/ProfileView/components/DiffLegend.tsx +2 -2
  45. package/src/ProfileView/components/GroupByLabelsDropdown/index.tsx +4 -4
  46. package/src/ProfileView/components/ProfileFilters/index.tsx +10 -10
  47. package/src/ProfileView/components/ProfileFilters/useProfileFilters.ts +10 -4
  48. package/src/ProfileView/components/Toolbars/index.tsx +2 -2
  49. package/src/ProfileView/hooks/{useResetStateOnNewSearch.ts → useResetFlameGraphState.ts} +1 -1
  50. package/src/ProfileView/hooks/useVisualizationState.ts +6 -7
  51. package/src/ProfileView/index.tsx +0 -4
  52. package/src/ProfileViewWithData.tsx +1 -1
  53. package/src/SimpleMatchers/index.tsx +9 -9
  54. package/src/ViewMatchers/index.tsx +2 -2
  55. package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts +0 -2
  56. package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts.map +0 -1
@@ -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
- }, [setAppliedFilters]);
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
- }, [setAppliedFilters]);
394
+ resetFlameGraphState();
395
+ }, [setAppliedFilters, resetFlameGraphState]);
390
396
 
391
397
  const protoFilters = useMemo(() => {
392
398
  return convertToProtoFilters(appliedFilters ?? []);
@@ -18,7 +18,7 @@ import {Icon} from '@iconify/react';
18
18
  import {QueryServiceClient} from '@parca/client';
19
19
  import {Button} from '@parca/components';
20
20
  import {ProfileType} from '@parca/parser';
21
- import {testId} from '@parca/test-utils';
21
+ import {TEST_IDS, testId} from '@parca/test-utils';
22
22
 
23
23
  import {CurrentPathFrame} from '../../../ProfileFlameGraph/FlameGraphArrow/utils';
24
24
  import {ProfileSource} from '../../../ProfileSource';
@@ -88,7 +88,7 @@ export const FlameGraphToolbar: FC<FlameGraphToolbarProps> = ({curPath, setNewCu
88
88
  onClick={() => setNewCurPath([])}
89
89
  disabled={curPath.length === 0}
90
90
  id="h-reset-graph"
91
- {...testId('FLAMEGRAPH_RESET_BUTTON')}
91
+ {...testId(TEST_IDS.FLAMEGRAPH_RESET_BUTTON)}
92
92
  >
93
93
  Reset graph
94
94
  <Icon icon="system-uicons:reset" width={20} />
@@ -13,7 +13,7 @@
13
13
 
14
14
  import {useURLState} from '@parca/components';
15
15
 
16
- export const useResetStateOnNewSearch = (): (() => void) => {
16
+ export const useResetFlameGraphState = (): (() => void) => {
17
17
  const [val, setCurPath] = useURLState('cur_path');
18
18
 
19
19
  return () => {
@@ -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, useState} from 'react';
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
  }
@@ -20,7 +20,7 @@ import cx from 'classnames';
20
20
  import {QueryServiceClient} from '@parca/client';
21
21
  import {useGrpcMetadata} from '@parca/components';
22
22
  import {Query} from '@parca/parser';
23
- import {testId} from '@parca/test-utils';
23
+ import {TEST_IDS, testId} from '@parca/test-utils';
24
24
  import {millisToProtoTimestamp, sanitizeLabelValue} from '@parca/utilities';
25
25
 
26
26
  import {LabelProvider, useLabels} from '../contexts/SimpleMatchersLabelContext';
@@ -357,10 +357,10 @@ const SimpleMatchers = ({
357
357
  <div
358
358
  className={`flex items-center gap-3 ${maxWidthInPixels} w-full flex-wrap`}
359
359
  id="simple-matchers"
360
- {...testId('SIMPLE_MATCHERS_CONTAINER')}
360
+ {...testId(TEST_IDS.SIMPLE_MATCHERS_CONTAINER)}
361
361
  >
362
362
  {visibleRows.map((row, index) => (
363
- <div key={index} className="flex items-center" {...testId('SIMPLE_MATCHER_ROW')}>
363
+ <div key={index} className="flex items-center" {...testId(TEST_IDS.SIMPLE_MATCHER_ROW)}>
364
364
  <Select
365
365
  items={labelNameOptions}
366
366
  onSelection={value => handleUpdateRow(index, 'labelName', value)}
@@ -369,14 +369,14 @@ const SimpleMatchers = ({
369
369
  className="rounded-tr-none rounded-br-none ring-0 focus:ring-0 outline-none"
370
370
  loading={labelNamesLoading}
371
371
  searchable={true}
372
- {...testId('LABEL_NAME_SELECT')}
372
+ {...testId(TEST_IDS.LABEL_NAME_SELECT)}
373
373
  />
374
374
  <Select
375
375
  items={operatorOptions}
376
376
  onSelection={value => handleUpdateRow(index, 'operator', value)}
377
377
  selectedKey={row.operator}
378
378
  className="rounded-none ring-0 focus:ring-0 outline-none"
379
- {...testId('OPERATOR_SELECT')}
379
+ {...testId(TEST_IDS.OPERATOR_SELECT)}
380
380
  />
381
381
  <Select
382
382
  items={transformLabelsForSelect(row.labelValues)}
@@ -392,14 +392,14 @@ const SimpleMatchers = ({
392
392
  loading={row.isLoading}
393
393
  onButtonClick={() => handleLabelValueClick(index)}
394
394
  editable={isRowRegex(row)}
395
- {...testId('LABEL_VALUE_SELECT')}
395
+ {...testId(TEST_IDS.LABEL_VALUE_SELECT)}
396
396
  />
397
397
  <button
398
398
  onClick={() => removeRow(index)}
399
399
  className={cx(
400
400
  'p-2 border-gray-200 border rounded rounded-tl-none rounded-bl-none focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900'
401
401
  )}
402
- {...testId('REMOVE_MATCHER_BUTTON')}
402
+ {...testId(TEST_IDS.REMOVE_MATCHER_BUTTON)}
403
403
  >
404
404
  <Icon icon="carbon:close" className="h-5 w-5 text-gray-400" aria-hidden="true" />
405
405
  </button>
@@ -410,7 +410,7 @@ const SimpleMatchers = ({
410
410
  <button
411
411
  onClick={() => setShowAll(!showAll)}
412
412
  className="mr-2 px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900"
413
- {...testId(showAll ? 'SHOW_LESS_BUTTON' : 'SHOW_MORE_BUTTON')}
413
+ {...testId(showAll ? TEST_IDS.SHOW_LESS_BUTTON : TEST_IDS.SHOW_MORE_BUTTON)}
414
414
  >
415
415
  {showAll ? 'Show less' : `Show ${hiddenRowsCount} more`}
416
416
  </button>
@@ -419,7 +419,7 @@ const SimpleMatchers = ({
419
419
  <button
420
420
  onClick={addNewRow}
421
421
  className="p-2 border-gray-200 dark:bg-gray-900 dark:border-gray-600 border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
422
- {...testId('ADD_MATCHER_BUTTON')}
422
+ {...testId(TEST_IDS.ADD_MATCHER_BUTTON)}
423
423
  >
424
424
  <Icon icon="material-symbols:add" className="h-5 w-5 text-gray-400" aria-hidden="true" />
425
425
  </button>
@@ -19,7 +19,7 @@ import cx from 'classnames';
19
19
  import {QueryServiceClient} from '@parca/client';
20
20
  import {useGrpcMetadata} from '@parca/components';
21
21
  import {Query} from '@parca/parser';
22
- import {testId} from '@parca/test-utils';
22
+ import {TEST_IDS, testId} from '@parca/test-utils';
23
23
  import {millisToProtoTimestamp, sanitizeLabelValue} from '@parca/utilities';
24
24
 
25
25
  import CustomSelect, {SelectItem} from '../SimpleMatchers/Select';
@@ -173,7 +173,7 @@ const ViewMatchers: React.FC<Props> = ({
173
173
  }, []);
174
174
 
175
175
  return (
176
- <div className="flex flex-wrap gap-2" {...testId('VIEW_MATCHERS_CONTAINER')}>
176
+ <div className="flex flex-wrap gap-2" {...testId(TEST_IDS.VIEW_MATCHERS_CONTAINER)}>
177
177
  {labelNames.map(labelName => (
178
178
  <div key={labelName} className="flex items-center">
179
179
  <div className="relative border shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 items-center justify-between bg-gray-100 dark:bg-gray-700 rounded-l-md border-gray-300 dark:border-gray-600">
@@ -1,2 +0,0 @@
1
- export declare const useResetStateOnNewSearch: () => (() => void);
2
- //# sourceMappingURL=useResetStateOnNewSearch.d.ts.map
@@ -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"}