@parca/profile 0.16.183 → 0.16.184

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.184](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.183...@parca/profile@0.16.184) (2023-06-15)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.16.183](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.182...@parca/profile@0.16.183) (2023-06-14)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -38,6 +38,7 @@ export interface ProfileViewProps {
38
38
  compare?: boolean;
39
39
  onDownloadPProf: () => void;
40
40
  onFlamegraphContainerResize?: ResizeHandler;
41
+ pprofDownloading?: boolean;
41
42
  }
42
- export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf, onFlamegraphContainerResize, }: ProfileViewProps) => JSX.Element;
43
+ export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, onDownloadPProf, onFlamegraphContainerResize, pprofDownloading, }: ProfileViewProps) => JSX.Element;
43
44
  export {};
@@ -93,7 +93,7 @@ function arrayEquals(a, b) {
93
93
  a.every(function (val, index) { return val === b[index]; }));
94
94
  }
95
95
  export var ProfileView = function (_a) {
96
- var total = _a.total, filtered = _a.filtered, flamegraphData = _a.flamegraphData, topTableData = _a.topTableData, callgraphData = _a.callgraphData, sampleUnit = _a.sampleUnit, profileSource = _a.profileSource, queryClient = _a.queryClient, navigateTo = _a.navigateTo, onDownloadPProf = _a.onDownloadPProf, onFlamegraphContainerResize = _a.onFlamegraphContainerResize;
96
+ var total = _a.total, filtered = _a.filtered, flamegraphData = _a.flamegraphData, topTableData = _a.topTableData, callgraphData = _a.callgraphData, sampleUnit = _a.sampleUnit, profileSource = _a.profileSource, queryClient = _a.queryClient, navigateTo = _a.navigateTo, onDownloadPProf = _a.onDownloadPProf, onFlamegraphContainerResize = _a.onFlamegraphContainerResize, pprofDownloading = _a.pprofDownloading;
97
97
  var _b = useContainerDimensions(), ref = _b.ref, dimensions = _b.dimensions;
98
98
  var _c = useState([]), curPath = _c[0], setCurPath = _c[1];
99
99
  var _d = useURLState({
@@ -240,7 +240,9 @@ export var ProfileView = function (_a) {
240
240
  return (_jsx(KeyDownProvider, { children: _jsx("div", __assign({ className: "py-3" }, { children: _jsx(Card, { children: _jsxs(Card.Body, { children: [_jsxs("div", __assign({ className: "flex w-full py-3" }, { children: [_jsxs("div", __assign({ className: "flex space-x-4 lg:w-1/2" }, { children: [_jsxs("div", __assign({ className: "flex space-x-1" }, { children: [profileSource !== undefined && queryClient !== undefined ? (_jsx(ProfileShareButton, { queryRequest: profileSource.QueryRequest(), queryClient: queryClient })) : null, _jsx(Button, __assign({ color: "neutral", onClick: function (e) {
241
241
  e.preventDefault();
242
242
  onDownloadPProf();
243
- } }, { children: "Download pprof" }))] })), _jsx(FilterByFunctionButton, { navigateTo: navigateTo })] })), _jsx("div", __assign({ className: "ml-auto flex gap-2" }, { children: _jsx(ViewSelector, { defaultValue: "", navigateTo: navigateTo, position: -1, placeholderText: "Add panel...", primary: true, addView: true, disabled: isMultiPanelView || dashboardItems.length < 1 }) }))] })), _jsx("div", __assign({ className: "w-full", ref: ref }, { children: isLoaderVisible ? (_jsx(_Fragment, { children: loader })) : (_jsx(DragDropContext, __assign({ onDragEnd: onDragEnd }, { children: _jsx(Droppable, __assign({ droppableId: "droppable", direction: "horizontal" }, { children: function (provided) { return (_jsx("div", __assign({ ref: provided.innerRef, className: "flex w-full justify-between space-x-4" }, provided.droppableProps, { children: dashboardItems.map(function (dashboardItem, index) {
243
+ }, disabled: pprofDownloading }, { children: pprofDownloading != null && pprofDownloading
244
+ ? 'Downloading'
245
+ : 'Download pprof' }))] })), _jsx(FilterByFunctionButton, { navigateTo: navigateTo })] })), _jsx("div", __assign({ className: "ml-auto flex gap-2" }, { children: _jsx(ViewSelector, { defaultValue: "", navigateTo: navigateTo, position: -1, placeholderText: "Add panel...", primary: true, addView: true, disabled: isMultiPanelView || dashboardItems.length < 1 }) }))] })), _jsx("div", __assign({ className: "w-full", ref: ref }, { children: isLoaderVisible ? (_jsx(_Fragment, { children: loader })) : (_jsx(DragDropContext, __assign({ onDragEnd: onDragEnd }, { children: _jsx(Droppable, __assign({ droppableId: "droppable", direction: "horizontal" }, { children: function (provided) { return (_jsx("div", __assign({ ref: provided.innerRef, className: "flex w-full justify-between space-x-4" }, provided.droppableProps, { children: dashboardItems.map(function (dashboardItem, index) {
244
246
  return (_jsx(Draggable, __assign({ draggableId: dashboardItem, index: index, isDragDisabled: !isMultiPanelView }, { children: function (provided, snapshot) { return (_createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, { key: dashboardItem, className: cx('rounded border border-gray-300 p-3 dark:border-gray-500 dark:bg-gray-700', isMultiPanelView ? 'w-1/2' : 'w-full', snapshot.isDragging ? 'bg-gray-200' : 'bg-white') }),
245
247
  _jsx(VisualizationPanel, { handleClosePanel: handleClosePanel, isMultiPanelView: isMultiPanelView, dashboardItem: dashboardItem, getDashboardItemByType: getDashboardItemByType, dragHandleProps: provided.dragHandleProps, navigateTo: navigateTo, index: index }))); } }), dashboardItem));
246
248
  }) }))); } })) }))) }))] }) }) })) }));
@@ -62,6 +62,7 @@ export var ProfileViewWithData = function (_a) {
62
62
  var dashboardItems = useURLState({ param: 'dashboard_items', navigateTo: navigateTo })[0];
63
63
  var _f = useState(0), nodeTrimThreshold = _f[0], setNodeTrimThreshold = _f[1];
64
64
  var enableTrimming = useUserPreference(USER_PREFERENCES.ENABLE_GRAPH_TRIMMING.key)[0];
65
+ var _g = useState(false), pprofDownloading = _g[0], setPprofDownloading = _g[1];
65
66
  useEffect(function () {
66
67
  if (!enableTrimming) {
67
68
  setNodeTrimThreshold(0);
@@ -77,17 +78,17 @@ export var ProfileViewWithData = function (_a) {
77
78
  }
78
79
  setNodeTrimThreshold(threshold);
79
80
  };
80
- var _g = useQuery(queryClient, profileSource, QueryRequest_ReportType.FLAMEGRAPH_TABLE, {
81
+ var _h = useQuery(queryClient, profileSource, QueryRequest_ReportType.FLAMEGRAPH_TABLE, {
81
82
  skip: !dashboardItems.includes('icicle'),
82
83
  nodeTrimThreshold: nodeTrimThreshold,
83
- }), flamegraphLoading = _g.isLoading, flamegraphResponse = _g.response, flamegraphError = _g.error;
84
+ }), flamegraphLoading = _h.isLoading, flamegraphResponse = _h.response, flamegraphError = _h.error;
84
85
  var perf = useParcaContext().perf;
85
- var _h = useQuery(queryClient, profileSource, QueryRequest_ReportType.TOP, {
86
+ var _j = useQuery(queryClient, profileSource, QueryRequest_ReportType.TOP, {
86
87
  skip: !dashboardItems.includes('table'),
87
- }), topTableLoading = _h.isLoading, topTableResponse = _h.response, topTableError = _h.error;
88
- var _j = useQuery(queryClient, profileSource, QueryRequest_ReportType.CALLGRAPH, {
88
+ }), topTableLoading = _j.isLoading, topTableResponse = _j.response, topTableError = _j.error;
89
+ var _k = useQuery(queryClient, profileSource, QueryRequest_ReportType.CALLGRAPH, {
89
90
  skip: !dashboardItems.includes('callgraph'),
90
- }), callgraphLoading = _j.isLoading, callgraphResponse = _j.response, callgraphError = _j.error;
91
+ }), callgraphLoading = _k.isLoading, callgraphResponse = _k.response, callgraphError = _k.error;
91
92
  useEffect(function () {
92
93
  var _a, _b;
93
94
  if (!flamegraphLoading && (flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.report.oneofKind) === 'flamegraph') {
@@ -120,13 +121,16 @@ export var ProfileViewWithData = function (_a) {
120
121
  _a.label = 1;
121
122
  case 1:
122
123
  _a.trys.push([1, 3, , 4]);
124
+ setPprofDownloading(true);
123
125
  return [4 /*yield*/, downloadPprof(profileSource.QueryRequest(), queryClient, metadata)];
124
126
  case 2:
125
127
  blob = _a.sent();
126
128
  saveAsBlob(blob, "profile.pb.gz");
129
+ setPprofDownloading(false);
127
130
  return [3 /*break*/, 4];
128
131
  case 3:
129
132
  error_1 = _a.sent();
133
+ setPprofDownloading(false);
130
134
  console.error('Error while querying', error_1);
131
135
  return [3 /*break*/, 4];
132
136
  case 4: return [2 /*return*/];
@@ -167,6 +171,6 @@ export var ProfileViewWithData = function (_a) {
167
171
  ? (_e = callgraphResponse === null || callgraphResponse === void 0 ? void 0 : callgraphResponse.report) === null || _e === void 0 ? void 0 : _e.callgraph
168
172
  : undefined,
169
173
  error: callgraphError,
170
- }, sampleUnit: sampleUnit, profileSource: profileSource, queryClient: queryClient, navigateTo: navigateTo, onDownloadPProf: function () { return void downloadPProfClick(); }, onFlamegraphContainerResize: onFlamegraphContainerResize }));
174
+ }, sampleUnit: sampleUnit, profileSource: profileSource, queryClient: queryClient, navigateTo: navigateTo, onDownloadPProf: function () { return void downloadPProfClick(); }, pprofDownloading: pprofDownloading, onFlamegraphContainerResize: onFlamegraphContainerResize }));
171
175
  };
172
176
  export default ProfileViewWithData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.183",
3
+ "version": "0.16.184",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.73",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
- "gitHead": "48ae0ca7edb2353bcb439a43e78bc19fdbc91d27"
49
+ "gitHead": "850348dc0238c127c875f12ac53b48856ee3c5a2"
50
50
  }
@@ -87,6 +87,7 @@ export interface ProfileViewProps {
87
87
  compare?: boolean;
88
88
  onDownloadPProf: () => void;
89
89
  onFlamegraphContainerResize?: ResizeHandler;
90
+ pprofDownloading?: boolean;
90
91
  }
91
92
 
92
93
  function arrayEquals<T>(a: T[], b: T[]): boolean {
@@ -110,6 +111,7 @@ export const ProfileView = ({
110
111
  navigateTo,
111
112
  onDownloadPProf,
112
113
  onFlamegraphContainerResize,
114
+ pprofDownloading,
113
115
  }: ProfileViewProps): JSX.Element => {
114
116
  const {ref, dimensions} = useContainerDimensions();
115
117
  const [curPath, setCurPath] = useState<string[]>([]);
@@ -331,8 +333,11 @@ export const ProfileView = ({
331
333
  e.preventDefault();
332
334
  onDownloadPProf();
333
335
  }}
336
+ disabled={pprofDownloading}
334
337
  >
335
- Download pprof
338
+ {pprofDownloading != null && pprofDownloading
339
+ ? 'Downloading'
340
+ : 'Download pprof'}
336
341
  </Button>
337
342
  </div>
338
343
  <FilterByFunctionButton navigateTo={navigateTo} />
@@ -39,6 +39,7 @@ export const ProfileViewWithData = ({
39
39
  const [dashboardItems] = useURLState({param: 'dashboard_items', navigateTo});
40
40
  const [nodeTrimThreshold, setNodeTrimThreshold] = useState<number>(0);
41
41
  const [enableTrimming] = useUserPreference<boolean>(USER_PREFERENCES.ENABLE_GRAPH_TRIMMING.key);
42
+ const [pprofDownloading, setPprofDownloading] = useState<boolean>(false);
42
43
 
43
44
  useEffect(() => {
44
45
  if (!enableTrimming) {
@@ -113,9 +114,12 @@ export const ProfileViewWithData = ({
113
114
  }
114
115
 
115
116
  try {
117
+ setPprofDownloading(true);
116
118
  const blob = await downloadPprof(profileSource.QueryRequest(), queryClient, metadata);
117
119
  saveAsBlob(blob, `profile.pb.gz`);
120
+ setPprofDownloading(false);
118
121
  } catch (error) {
122
+ setPprofDownloading(false);
119
123
  console.error('Error while querying', error);
120
124
  }
121
125
  };
@@ -168,6 +172,7 @@ export const ProfileViewWithData = ({
168
172
  queryClient={queryClient}
169
173
  navigateTo={navigateTo}
170
174
  onDownloadPProf={() => void downloadPProfClick()}
175
+ pprofDownloading={pprofDownloading}
171
176
  onFlamegraphContainerResize={onFlamegraphContainerResize}
172
177
  />
173
178
  );