@parca/profile 0.16.351 → 0.16.352

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 CHANGED
@@ -3,6 +3,10 @@
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.352 (2024-02-29)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.16.351](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.350...@parca/profile@0.16.351) (2024-02-28)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -14,7 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { useEffect, useState } from 'react';
15
15
  import { Provider } from 'react-redux';
16
16
  import { DateTimeRange, KeyDownProvider, useParcaContext } from '@parca/components';
17
- import { store } from '@parca/store';
17
+ import { createStore } from '@parca/store';
18
18
  import { capitalizeOnlyFirstLetter } from '@parca/utilities';
19
19
  import { ProfileSelectionFromParams, SuffixParams } from '..';
20
20
  import { useProfileTypes } from '../ProfileSelector';
@@ -258,7 +258,8 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
258
258
  return (_jsx(ProfileExplorerCompare, { queryClient: queryClient, queryA: queryA, queryB: queryB, profileA: profileA, profileB: profileB, selectQueryA: selectQueryA, selectQueryB: selectQueryB, selectProfileA: selectProfileA, selectProfileB: selectProfileB, closeProfile: closeProfile, navigateTo: navigateTo }));
259
259
  };
260
260
  const ProfileExplorer = ({ queryClient, queryParams, navigateTo, }) => {
261
- const { store: reduxStore } = store();
261
+ const { additionalFlamegraphColorProfiles } = useParcaContext();
262
+ const { store: reduxStore } = createStore(additionalFlamegraphColorProfiles);
262
263
  return (_jsx(Provider, { store: reduxStore, children: _jsx(KeyDownProvider, { children: _jsx(ProfileExplorerApp, { queryClient: queryClient, queryParams: queryParams, navigateTo: navigateTo }) }) }));
263
264
  };
264
265
  export default ProfileExplorer;
@@ -11,11 +11,12 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { useMemo } from 'react';
14
- import { EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector } from '@parca/store';
15
- import { COLOR_PROFILES, diffColor } from '@parca/utilities';
14
+ import { EVERYTHING_ELSE, selectColorProfiles, selectDarkMode, selectStackColors, useAppSelector, } from '@parca/store';
15
+ import { diffColor } from '@parca/utilities';
16
16
  const useNodeColor = ({ data, compareMode }) => {
17
17
  const colors = useAppSelector(selectStackColors);
18
18
  const isDarkMode = useAppSelector(selectDarkMode);
19
+ const colorProfiles = useAppSelector(selectColorProfiles);
19
20
  const color = useMemo(() => {
20
21
  if (compareMode) {
21
22
  const diff = data.diff;
@@ -23,9 +24,9 @@ const useNodeColor = ({ data, compareMode }) => {
23
24
  return diffColor(diff, cumulative, isDarkMode);
24
25
  }
25
26
  const color = colors[data.feature ?? EVERYTHING_ELSE] ??
26
- (!isDarkMode ? COLOR_PROFILES.default.colors[0][0] : COLOR_PROFILES.default.colors[0][1]);
27
+ (!isDarkMode ? colorProfiles.default.colors[0][0] : colorProfiles.default.colors[0][1]);
27
28
  return color;
28
- }, [data, colors, isDarkMode, compareMode]);
29
+ }, [data, colors, isDarkMode, compareMode, colorProfiles]);
29
30
  return color;
30
31
  };
31
32
  export default useNodeColor;
@@ -14,9 +14,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
15
15
  import { tableFromIPC } from 'apache-arrow';
16
16
  import { useContextMenu } from 'react-contexify';
17
- import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
18
- import { getColorForFeature, getColorForSimilarNodes, selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector, } from '@parca/store';
19
- import { getLastItem, scaleLinear, selectQueryParam, } from '@parca/utilities';
17
+ import { USER_PREFERENCES, useCurrentColorProfile, useUserPreference } from '@parca/hooks';
18
+ import { getColorForFeature, selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector, } from '@parca/store';
19
+ import { getLastItem, scaleLinear, selectQueryParam } from '@parca/utilities';
20
20
  import GraphTooltipArrow from '../../GraphTooltipArrow';
21
21
  import GraphTooltipArrowContent from '../../GraphTooltipArrow/Content';
22
22
  import { DockedGraphTooltip } from '../../GraphTooltipArrow/DockedGraphTooltip';
@@ -42,7 +42,6 @@ export const FIELD_DIFF = 'diff';
42
42
  export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, filtered, width, setCurPath, curPath, sampleUnit, navigateTo, sortBy, }) {
43
43
  const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
44
44
  const dispatch = useAppDispatch();
45
- const [colorProfile] = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key);
46
45
  const [highlightSimilarStacksPreference] = useUserPreference(USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key);
47
46
  const [dockedMetainfo] = useUserPreference(USER_PREFERENCES.GRAPH_METAINFO_DOCKED.key);
48
47
  const isDarkMode = useAppSelector(selectDarkMode);
@@ -58,7 +57,8 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, f
58
57
  const currentSearchString = selectQueryParam('search_string') ?? '';
59
58
  const { compareMode } = useProfileViewContext();
60
59
  const isColorStackLegendEnabled = selectQueryParam('color_stack_legend') === 'true';
61
- const colorForSimilarNodes = getColorForSimilarNodes(colorProfile);
60
+ const currentColorProfile = useCurrentColorProfile();
61
+ const colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
62
62
  const mappings = useMemo(() => {
63
63
  // Read the mappings from the dictionary that contains all mapping strings.
64
64
  // This is great, as might only have a dozen or so mappings,
@@ -110,10 +110,10 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, f
110
110
  const mappingColors = useMemo(() => {
111
111
  const colors = {};
112
112
  Object.entries(mappingFeatures).forEach(([_, feature]) => {
113
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, colorProfile);
113
+ colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
114
114
  });
115
115
  return colors;
116
- }, [colorProfile, isDarkMode, mappingFeatures]);
116
+ }, [isDarkMode, mappingFeatures, currentColorProfile]);
117
117
  useEffect(() => {
118
118
  if (ref.current != null) {
119
119
  setHeight(ref?.current.getBoundingClientRect().height);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.351",
3
+ "version": "0.16.352",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.106",
7
- "@parca/components": "^0.16.259",
7
+ "@parca/components": "^0.16.260",
8
8
  "@parca/dynamicsize": "^0.16.61",
9
- "@parca/hooks": "^0.0.44",
9
+ "@parca/hooks": "^0.0.45",
10
10
  "@parca/parser": "^0.16.69",
11
- "@parca/store": "^0.16.133",
12
- "@parca/utilities": "^0.0.61",
11
+ "@parca/store": "^0.16.134",
12
+ "@parca/utilities": "^0.0.62",
13
13
  "@tanstack/react-query": "^4.0.5",
14
14
  "@types/react-beautiful-dnd": "^13.1.8",
15
15
  "apache-arrow": "^12.0.0",
@@ -50,5 +50,5 @@
50
50
  "access": "public",
51
51
  "registry": "https://registry.npmjs.org/"
52
52
  },
53
- "gitHead": "f92df4afcaf89ccbf154cb3df4f9272b12b98622"
53
+ "gitHead": "21d9b84fb528ea62b8d3c931671264371aca90c2"
54
54
  }
@@ -17,7 +17,7 @@ import {Provider} from 'react-redux';
17
17
 
18
18
  import {QueryServiceClient} from '@parca/client';
19
19
  import {DateTimeRange, KeyDownProvider, useParcaContext} from '@parca/components';
20
- import {store} from '@parca/store';
20
+ import {createStore} from '@parca/store';
21
21
  import {capitalizeOnlyFirstLetter, type NavigateFunction} from '@parca/utilities';
22
22
 
23
23
  import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
@@ -406,7 +406,8 @@ const ProfileExplorer = ({
406
406
  queryParams,
407
407
  navigateTo,
408
408
  }: ProfileExplorerProps): JSX.Element => {
409
- const {store: reduxStore} = store();
409
+ const {additionalFlamegraphColorProfiles} = useParcaContext();
410
+ const {store: reduxStore} = createStore(additionalFlamegraphColorProfiles);
410
411
 
411
412
  return (
412
413
  <Provider store={reduxStore}>
@@ -13,8 +13,14 @@
13
13
 
14
14
  import {useMemo} from 'react';
15
15
 
16
- import {EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector} from '@parca/store';
17
- import {COLOR_PROFILES, diffColor} from '@parca/utilities';
16
+ import {
17
+ EVERYTHING_ELSE,
18
+ selectColorProfiles,
19
+ selectDarkMode,
20
+ selectStackColors,
21
+ useAppSelector,
22
+ } from '@parca/store';
23
+ import {diffColor} from '@parca/utilities';
18
24
 
19
25
  import type {ColoredFlamegraphNode} from './useColoredGraph';
20
26
 
@@ -26,6 +32,7 @@ interface Props {
26
32
  const useNodeColor = ({data, compareMode}: Props): string => {
27
33
  const colors = useAppSelector(selectStackColors);
28
34
  const isDarkMode = useAppSelector(selectDarkMode);
35
+ const colorProfiles = useAppSelector(selectColorProfiles);
29
36
 
30
37
  const color: string = useMemo(() => {
31
38
  if (compareMode) {
@@ -36,10 +43,10 @@ const useNodeColor = ({data, compareMode}: Props): string => {
36
43
 
37
44
  const color =
38
45
  colors[data.feature ?? EVERYTHING_ELSE] ??
39
- (!isDarkMode ? COLOR_PROFILES.default.colors[0][0] : COLOR_PROFILES.default.colors[0][1]);
46
+ (!isDarkMode ? colorProfiles.default.colors[0][0] : colorProfiles.default.colors[0][1]);
40
47
 
41
48
  return color;
42
- }, [data, colors, isDarkMode, compareMode]);
49
+ }, [data, colors, isDarkMode, compareMode, colorProfiles]);
43
50
 
44
51
  return color;
45
52
  };
@@ -17,22 +17,15 @@ import {Dictionary, Table, Vector, tableFromIPC} from 'apache-arrow';
17
17
  import {useContextMenu} from 'react-contexify';
18
18
 
19
19
  import {FlamegraphArrow} from '@parca/client';
20
- import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
20
+ import {USER_PREFERENCES, useCurrentColorProfile, useUserPreference} from '@parca/hooks';
21
21
  import {
22
22
  getColorForFeature,
23
- getColorForSimilarNodes,
24
23
  selectDarkMode,
25
24
  setHoveringNode,
26
25
  useAppDispatch,
27
26
  useAppSelector,
28
27
  } from '@parca/store';
29
- import {
30
- getLastItem,
31
- scaleLinear,
32
- selectQueryParam,
33
- type ColorProfileName,
34
- type NavigateFunction,
35
- } from '@parca/utilities';
28
+ import {getLastItem, scaleLinear, selectQueryParam, type NavigateFunction} from '@parca/utilities';
36
29
 
37
30
  import GraphTooltipArrow from '../../GraphTooltipArrow';
38
31
  import GraphTooltipArrowContent from '../../GraphTooltipArrow/Content';
@@ -83,9 +76,6 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
83
76
  }: IcicleGraphArrowProps): React.JSX.Element {
84
77
  const [isContextMenuOpen, setIsContextMenuOpen] = useState<boolean>(false);
85
78
  const dispatch = useAppDispatch();
86
- const [colorProfile] = useUserPreference<ColorProfileName>(
87
- USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key
88
- );
89
79
  const [highlightSimilarStacksPreference] = useUserPreference<boolean>(
90
80
  USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key
91
81
  );
@@ -106,7 +96,8 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
106
96
  const currentSearchString = (selectQueryParam('search_string') as string) ?? '';
107
97
  const {compareMode} = useProfileViewContext();
108
98
  const isColorStackLegendEnabled = selectQueryParam('color_stack_legend') === 'true';
109
- const colorForSimilarNodes = getColorForSimilarNodes(colorProfile);
99
+ const currentColorProfile = useCurrentColorProfile();
100
+ const colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
110
101
 
111
102
  const mappings = useMemo(() => {
112
103
  // Read the mappings from the dictionary that contains all mapping strings.
@@ -165,10 +156,14 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
165
156
  const mappingColors = useMemo(() => {
166
157
  const colors: mappingColors = {};
167
158
  Object.entries(mappingFeatures).forEach(([_, feature]) => {
168
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, colorProfile);
159
+ colors[feature.name] = getColorForFeature(
160
+ feature.name,
161
+ isDarkMode,
162
+ currentColorProfile.colors
163
+ );
169
164
  });
170
165
  return colors;
171
- }, [colorProfile, isDarkMode, mappingFeatures]);
166
+ }, [isDarkMode, mappingFeatures, currentColorProfile]);
172
167
 
173
168
  useEffect(() => {
174
169
  if (ref.current != null) {
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca10mGraphData from './benchdata/parca-10m.json';
19
19
  import {Flamegraph} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca10mGraph = parca10mGraphData as Flamegraph;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '../';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import {Flamegraph} from '@parca/client';
19
19
  import parca1mGraphData from './benchdata/parca-1m.json';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca1mGraph = parca1mGraphData as Flamegraph;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca20mGraphData from './benchdata/parca-20m.json';
19
19
  import {Flamegraph} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca20mGraph = parca20mGraphData as Flamegraph;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca10mGraphData from './benchdata/parca-toptable-10m.json';
19
19
  import {Top} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca10mGraph = parca10mGraphData as Top;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import {Top} from '@parca/client';
19
19
  import parca1mGraphData from './benchdata/parca-toptable-1m.json';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca1mGraph = parca1mGraphData as Top;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca20mGraphData from './benchdata/parca-toptable-20m.json';
19
19
  import {Top} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca20mGraph = parca20mGraphData as Top;
24
24