@parca/profile 0.16.43 β†’ 0.16.50

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,22 @@
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.50](https://github.com/parca-dev/parca/compare/ui-v0.16.49...ui-v0.16.50) (2022-10-18)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.49](https://github.com/parca-dev/parca/compare/ui-v0.16.48...ui-v0.16.49) (2022-10-17)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
14
+ ## [0.16.48](https://github.com/parca-dev/parca/compare/ui-v0.16.47...ui-v0.16.48) (2022-10-17)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
18
+ ## [0.16.44](https://github.com/parca-dev/parca/compare/ui-v0.16.43...ui-v0.16.44) (2022-10-13)
19
+
20
+ **Note:** Version bump only for package @parca/profile
21
+
6
22
  ## [0.16.43](https://github.com/parca-dev/parca/compare/ui-v0.16.42...ui-v0.16.43) (2022-10-13)
7
23
 
8
24
  **Note:** Version bump only for package @parca/profile
@@ -38,7 +38,7 @@ import { useState, useEffect } from 'react';
38
38
  import { usePopper } from 'react-popper';
39
39
  import { getLastItem, valueFormatter } from '@parca/functions';
40
40
  import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
41
- import { hexifyAddress } from '../';
41
+ import { hexifyAddress, truncateString } from '../';
42
42
  var virtualElement = {
43
43
  getBoundingClientRect: function () {
44
44
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -87,7 +87,7 @@ var TooltipMetaInfo = function (_a) {
87
87
  };
88
88
  return (_jsxs(_Fragment, { children: [((_b = hoveringNode.meta.function) === null || _b === void 0 ? void 0 : _b.filename) !== undefined &&
89
89
  ((_c = hoveringNode.meta.function) === null || _c === void 0 ? void 0 : _c.filename) !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "File" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: getTextForFile(hoveringNode) }, { children: _jsx("button", __assign({ className: "cursor-pointer text-left" }, { children: getTextForFile(hoveringNode) })) })) }))] })), ((_d = hoveringNode.meta.location) === null || _d === void 0 ? void 0 : _d.address) !== undefined &&
90
- ((_e = hoveringNode.meta.location) === null || _e === void 0 ? void 0 : _e.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: ' 0x' + hoveringNode.meta.location.address.toString() }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.file }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.file) })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.buildId !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Build Id" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.buildId }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.buildId) })) })) }))] }))] }));
90
+ ((_e = hoveringNode.meta.location) === null || _e === void 0 ? void 0 : _e.address) !== '0' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Address" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: ' 0x' + hoveringNode.meta.location.address.toString() }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: ' 0x' + hoveringNode.meta.location.address.toString() })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.file !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Binary" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.file }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: getLastItem(hoveringNode.meta.mapping.file) })) })) }))] })), hoveringNode.meta.mapping !== undefined && hoveringNode.meta.mapping.buildId !== '' && (_jsxs("tr", { children: [_jsx("td", __assign({ className: "w-1/5" }, { children: "Build Id" })), _jsx("td", __assign({ className: "w-4/5 break-all" }, { children: _jsx(CopyToClipboard, __assign({ onCopy: onCopy, text: hoveringNode.meta.mapping.buildId }, { children: _jsx("button", __assign({ className: "cursor-pointer" }, { children: truncateString(getLastItem(hoveringNode.meta.mapping.buildId), 16) })) })) }))] }))] }));
91
91
  };
92
92
  var timeoutHandle = null;
93
93
  var GraphTooltipContent = function (_a) {
package/dist/utils.d.ts CHANGED
@@ -2,3 +2,4 @@ import { QueryRequest, QueryServiceClient } from '@parca/client';
2
2
  import { RpcMetadata } from '@protobuf-ts/runtime-rpc';
3
3
  export declare const hexifyAddress: (address?: string) => string;
4
4
  export declare const downloadPprof: (request: QueryRequest, queryClient: QueryServiceClient, metadata: RpcMetadata) => Promise<Blob>;
5
+ export declare const truncateString: (str: string, num: number) => string;
package/dist/utils.js CHANGED
@@ -81,3 +81,9 @@ export var downloadPprof = function (request, queryClient, metadata) { return __
81
81
  }
82
82
  });
83
83
  }); };
84
+ export var truncateString = function (str, num) {
85
+ if (str.length <= num) {
86
+ return str;
87
+ }
88
+ return str.slice(0, num) + '...';
89
+ };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.43",
3
+ "version": "0.16.50",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@iconify/react": "^3.2.2",
7
- "@parca/client": "^0.16.22",
8
- "@parca/components": "^0.16.43",
9
- "@parca/dynamicsize": "^0.16.22",
10
- "@parca/functions": "^0.16.22",
11
- "@parca/parser": "^0.16.22",
12
- "@parca/store": "^0.16.22",
7
+ "@parca/client": "^0.16.49",
8
+ "@parca/components": "^0.16.49",
9
+ "@parca/dynamicsize": "^0.16.49",
10
+ "@parca/functions": "^0.16.49",
11
+ "@parca/parser": "^0.16.49",
12
+ "@parca/store": "^0.16.49",
13
13
  "d3-scale": "^4.0.2",
14
14
  "d3-selection": "3.0.0",
15
15
  "react-copy-to-clipboard": "^5.1.0"
@@ -31,5 +31,5 @@
31
31
  "access": "public",
32
32
  "registry": "https://registry.npmjs.org/"
33
33
  },
34
- "gitHead": "6abe2900480e4d043611fb7587b898c12f4f1518"
34
+ "gitHead": "5d06484489b4317175c47ac3a6070d40e0ebae76"
35
35
  }
@@ -18,7 +18,7 @@ import {usePopper} from 'react-popper';
18
18
  import {CallgraphNode, FlamegraphNode, FlamegraphRootNode} from '@parca/client';
19
19
  import {getLastItem, valueFormatter} from '@parca/functions';
20
20
  import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
21
- import {hexifyAddress} from '../';
21
+ import {hexifyAddress, truncateString} from '../';
22
22
 
23
23
  interface GraphTooltipProps {
24
24
  x: number;
@@ -130,7 +130,7 @@ const TooltipMetaInfo = ({
130
130
  <td className="w-4/5 break-all">
131
131
  <CopyToClipboard onCopy={onCopy} text={hoveringNode.meta.mapping.buildId}>
132
132
  <button className="cursor-pointer">
133
- {getLastItem(hoveringNode.meta.mapping.buildId)}
133
+ {truncateString(getLastItem(hoveringNode.meta.mapping.buildId) as string, 16)}
134
134
  </button>
135
135
  </CopyToClipboard>
136
136
  </td>
package/src/utils.ts CHANGED
@@ -42,3 +42,11 @@ export const downloadPprof = async (
42
42
  const blob = new Blob([response.report.pprof], {type: 'application/octet-stream'});
43
43
  return blob;
44
44
  };
45
+
46
+ export const truncateString = (str: string, num: number): string => {
47
+ if (str.length <= num) {
48
+ return str;
49
+ }
50
+
51
+ return str.slice(0, num) + '...';
52
+ };
@@ -1,5 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
2
- import ProfileTypeSelector from '../ProfileTypeSelector';
3
- declare const _default: ComponentMeta<({ profileTypesData, loading, error, selectedKey, onSelection, flexibleKnownProfilesDetection, }: import("../ProfileTypeSelector").Props) => JSX.Element>;
4
- export default _default;
5
- export declare const Primary: ComponentStory<typeof ProfileTypeSelector>;
@@ -1,77 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import ProfileTypeSelector from '../ProfileTypeSelector';
3
- export default {
4
- /* πŸ‘‡ The title prop is optional.
5
- * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
6
- * to learn how to generate automatic titles
7
- */
8
- title: 'Components/ProfileTypeSelector',
9
- component: ProfileTypeSelector,
10
- };
11
- const profileTypes = {
12
- types: [
13
- {
14
- name: 'memory',
15
- sampleType: 'inuse_objects',
16
- sampleUnit: 'count',
17
- periodType: 'space',
18
- periodUnit: 'bytes',
19
- delta: false,
20
- },
21
- {
22
- name: 'memory',
23
- sampleType: 'inuse_space',
24
- sampleUnit: 'bytes',
25
- periodType: 'space',
26
- periodUnit: 'bytes',
27
- delta: false,
28
- },
29
- {
30
- name: 'memory',
31
- sampleType: 'alloc_objects',
32
- sampleUnit: 'count',
33
- periodType: 'space',
34
- periodUnit: 'bytes',
35
- delta: false,
36
- },
37
- {
38
- name: 'goroutine',
39
- sampleType: 'goroutine',
40
- sampleUnit: 'count',
41
- periodType: 'goroutine',
42
- periodUnit: 'count',
43
- delta: false,
44
- },
45
- {
46
- name: 'memory',
47
- sampleType: 'alloc_space',
48
- sampleUnit: 'bytes',
49
- periodType: 'space',
50
- periodUnit: 'bytes',
51
- delta: false,
52
- },
53
- {
54
- name: 'process_cpu',
55
- sampleType: 'cpu',
56
- sampleUnit: 'nanoseconds',
57
- periodType: 'cpu',
58
- periodUnit: 'nanoseconds',
59
- delta: true,
60
- },
61
- {
62
- name: 'process_cpu',
63
- sampleType: 'samples',
64
- sampleUnit: 'count',
65
- periodType: 'cpu',
66
- periodUnit: 'nanoseconds',
67
- delta: true,
68
- },
69
- ],
70
- };
71
- const onSelection = () => { };
72
- //πŸ‘‡ We create a β€œtemplate” of how args map to rendering
73
- // const Template: ComponentStory<typeof ProfileView> = args => <ProfileView {...args} />;
74
- //πŸ‘‡ Each story then reuses that template
75
- // export const Primary = Template.bind({});
76
- // Primary.args = {sampleUnit: 'count', label: 'Button'};
77
- export const Primary = () => (_jsx(ProfileTypeSelector, { profileTypesData: profileTypes, onSelection: onSelection, selectedKey: "process_cpu:samples:count:cpu:nanoseconds:delta", error: undefined }));
@@ -1,5 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
2
- import { ProfileView } from '../ProfileView';
3
- declare const _default: ComponentMeta<({ flamegraphData, topTableData, callgraphData, sampleUnit, profileSource, queryClient, navigateTo, profileVisState, onDownloadPProf, }: import("../ProfileView").ProfileViewProps) => JSX.Element>;
4
- export default _default;
5
- export declare const Primary: ComponentStory<typeof ProfileView>;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ProfileView } from '../ProfileView';
3
- import flamegraphData from './mockdata/flamegraphData.json';
4
- export default {
5
- /* πŸ‘‡ The title prop is optional.
6
- * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
7
- * to learn how to generate automatic titles
8
- */
9
- title: 'Components/ProfileView',
10
- component: ProfileView,
11
- };
12
- const mockVisState = {
13
- currentView: 'icicle',
14
- setCurrentView: () => { },
15
- };
16
- const downloadPprof = () => { };
17
- //πŸ‘‡ We create a β€œtemplate” of how args map to rendering
18
- // const Template: ComponentStory<typeof ProfileView> = args => <ProfileView {...args} />;
19
- //πŸ‘‡ Each story then reuses that template
20
- // export const Primary = Template.bind({});
21
- // Primary.args = {sampleUnit: 'count', label: 'Button'};
22
- export const Primary = () => (_jsx(ProfileView, { flamegraphData: flamegraphData, sampleUnit: "count", profileVisState: mockVisState, onDownloadPProf: downloadPprof }));