@parca/profile 0.14.13 → 0.14.30

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,33 @@
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.14.30](https://github.com/parca-dev/parca/compare/ui-v0.14.29...ui-v0.14.30) (2022-08-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui:** run eslint --fix ([#1542](https://github.com/parca-dev/parca/issues/1542)) ([e522131](https://github.com/parca-dev/parca/commit/e5221318fc1140d661c45d2d04b096bfebba4af4))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.14.29](https://github.com/parca-dev/parca/compare/ui-v0.14.28...ui-v0.14.29) (2022-08-15)
18
+
19
+
20
+
21
+ ## 0.14.21 (2022-08-10)
22
+
23
+ **Note:** Version bump only for package @parca/profile
24
+
25
+
26
+
27
+
28
+
29
+ ## [0.14.16](https://github.com/parca-dev/parca/compare/ui-v0.14.15...ui-v0.14.16) (2022-08-03)
30
+
31
+ **Note:** Version bump only for package @parca/profile
32
+
6
33
  ## [0.14.13](https://github.com/parca-dev/parca/compare/ui-v0.14.12...ui-v0.14.13) (2022-08-03)
7
34
 
8
35
  ## [0.14.7](https://github.com/parca-dev/parca/compare/ui-v0.14.5...ui-v0.14.7) (2022-07-27)
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.14.13",
3
+ "version": "0.14.30",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@iconify/react": "^3.2.2",
7
- "@parca/client": "^0.14.12",
8
- "@parca/dynamicsize": "^0.14.1",
9
- "@parca/parser": "^0.14.1",
7
+ "@parca/client": "^0.14.16",
8
+ "@parca/dynamicsize": "^0.14.29",
9
+ "@parca/parser": "^0.14.29",
10
10
  "d3-scale": "^4.0.2",
11
11
  "d3-selection": "3.0.0",
12
12
  "react-copy-to-clipboard": "^5.1.0"
@@ -22,5 +22,5 @@
22
22
  "access": "public",
23
23
  "registry": "https://registry.npmjs.org/"
24
24
  },
25
- "gitHead": "614acf00ec750eaee1d52b8e8a827c5c8d54ccfc"
25
+ "gitHead": "9c8d0ec834d23db619a26b999d543c6bc40f7e16"
26
26
  }
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import React, {MouseEvent, useEffect, useRef, useState} from 'react';
2
15
 
3
16
  import {throttle} from 'lodash';
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {Flamegraph} from '@parca/client';
2
15
  import {useAppSelector, selectCompareMode} from '@parca/store';
3
16
  import {useContainerDimensions} from '@parca/dynamicsize';
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import React from 'react';
2
15
  import {formatDate} from '@parca/functions';
3
16
  import {Query, ProfileType} from '@parca/parser';
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import React, {useEffect, useMemo, useState} from 'react';
2
15
 
3
16
  import {parseParams} from '@parca/functions';
@@ -113,7 +126,7 @@ export const ProfileView = ({
113
126
 
114
127
  const downloadPProf = async (e: React.MouseEvent<HTMLElement>) => {
115
128
  e.preventDefault();
116
- if (!profileSource || !queryClient) {
129
+ if (profileSource == null || queryClient == null) {
117
130
  return;
118
131
  }
119
132
 
@@ -156,7 +169,7 @@ export const ProfileView = ({
156
169
  <div className="flex py-3 w-full">
157
170
  <div className="w-2/5 flex space-x-4">
158
171
  <div className="flex space-x-1">
159
- {profileSource && queryClient ? (
172
+ {profileSource != null && queryClient != null ? (
160
173
  <ProfileShareButton
161
174
  queryRequest={profileSource.QueryRequest()}
162
175
  queryClient={queryClient}
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {QueryServiceClient, QueryRequest_ReportType} from '@parca/client';
2
15
 
3
16
  import {useQuery} from './useQuery';
package/src/TopTable.tsx CHANGED
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import React from 'react';
2
15
 
3
16
  import {getLastItem, valueFormatter, isSearchMatch} from '@parca/functions';
@@ -33,7 +46,7 @@ const useSortableData = (top?: Top, config = {key: 'cumulative', direction: 'des
33
46
  config
34
47
  );
35
48
 
36
- const rawTableReport = top ? top.list : [];
49
+ const rawTableReport = top != null ? top.list : [];
37
50
 
38
51
  const items = rawTableReport.map(node => ({
39
52
  ...node,
@@ -46,7 +59,7 @@ const useSortableData = (top?: Top, config = {key: 'cumulative', direction: 'des
46
59
  const sortedItems = React.useMemo(() => {
47
60
  if (!items) return;
48
61
 
49
- let sortableItems = [...items];
62
+ const sortableItems = [...items];
50
63
  if (sortConfig !== null) {
51
64
  sortableItems.sort((a, b) => {
52
65
  if (a[sortConfig.key] < b[sortConfig.key]) {
@@ -63,7 +76,7 @@ const useSortableData = (top?: Top, config = {key: 'cumulative', direction: 'des
63
76
 
64
77
  const requestSort = key => {
65
78
  let direction = 'desc';
66
- if (sortConfig && sortConfig.key === key && sortConfig.direction === 'desc') {
79
+ if (sortConfig != null && sortConfig.key === key && sortConfig.direction === 'desc') {
67
80
  direction = 'asc';
68
81
  }
69
82
  setSortConfig({key, direction});
@@ -83,7 +96,7 @@ export const RowLabel = (meta: TopNodeMeta | undefined): string => {
83
96
  return `${mapping} ${meta.function.name}`;
84
97
 
85
98
  const address = hexifyAddress(meta.location?.address);
86
- const fallback = `${mapping} ${address as string}`;
99
+ const fallback = `${mapping} ${address}`;
87
100
 
88
101
  return fallback === '' ? '<unknown>' : fallback;
89
102
  };
@@ -96,11 +109,11 @@ export const TopTable = ({data: top, sampleUnit}: TopTableProps): JSX.Element =>
96
109
 
97
110
  const unit = sampleUnit;
98
111
 
99
- const total = top ? top.list.length : 0;
112
+ const total = top != null ? top.list.length : 0;
100
113
  if (total === 0) return <>Profile has no samples</>;
101
114
 
102
115
  const getClassNamesFor = name => {
103
- if (!sortConfig) {
116
+ if (sortConfig == null) {
104
117
  return;
105
118
  }
106
119
  return sortConfig.key === name ? sortConfig.direction : undefined;
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {SuffixParams, ParseLabels} from '../ProfileSource';
2
15
 
3
16
  test('prefixes keys', () => {
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {Fragment, useState} from 'react';
2
15
  import {Popover, Transition} from '@headlessui/react';
3
16
  import {useAppSelector, selectDarkMode} from '@parca/store';
@@ -44,7 +57,7 @@ const DiffLegendBar = ({
44
57
  const DiffLegend = () => {
45
58
  const [showLegendTooltip, setShowLegendTooltip] = useState(false);
46
59
  const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
47
- let [referenceElement, setReferenceElement] = useState<HTMLDivElement | null>(null);
60
+ const [referenceElement, setReferenceElement] = useState<HTMLDivElement | null>(null);
48
61
 
49
62
  const {styles, attributes, ...popperProps} = usePopper(referenceElement, popperElement, {
50
63
  placement: 'auto-start',
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {useState} from 'react';
2
15
  import cx from 'classnames';
3
16
  import {Icon} from '@iconify/react';
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {useState} from 'react';
2
15
  import {Button, Modal, useGrpcMetadata} from '@parca/components';
3
16
  import {Icon} from '@iconify/react';
package/src/index.tsx CHANGED
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  export * from './IcicleGraph';
2
15
  export * from './ProfileIcicleGraph';
3
16
  export * from './ProfileSource';
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {useEffect, useState} from 'react';
2
15
 
3
16
  interface DelayedLoaderOptions {
@@ -5,7 +18,7 @@ interface DelayedLoaderOptions {
5
18
  }
6
19
 
7
20
  const useDelayedLoader = (isLoading = false, options?: DelayedLoaderOptions) => {
8
- const {delay = 500} = options || {};
21
+ const {delay = 500} = options != null || {};
9
22
  const [isLoaderVisible, setIsLoaderVisible] = useState<boolean>(false);
10
23
  useEffect(() => {
11
24
  let showLoaderTimeout;
package/src/useQuery.tsx CHANGED
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {useEffect, useState} from 'react';
2
15
 
3
16
  import {QueryServiceClient, QueryResponse, QueryRequest_ReportType} from '@parca/client';
@@ -22,7 +35,7 @@ export const useQuery = (
22
35
  reportType: QueryRequest_ReportType,
23
36
  options?: UseQueryOptions
24
37
  ): IQueryResult => {
25
- const {skip = false} = options || {};
38
+ const {skip = false} = options != null || {};
26
39
  const [result, setResult] = useState<IQueryResult>({
27
40
  response: null,
28
41
  error: null,
@@ -45,8 +58,8 @@ export const useQuery = (
45
58
  const call = client.query(req, {meta: metadata});
46
59
 
47
60
  call.response
48
- .then(response => setResult({response: response, error: null, isLoading: false}))
49
- .catch(error => setResult({error: error, response: null, isLoading: false}));
61
+ .then(response => setResult({response, error: null, isLoading: false}))
62
+ .catch(error => setResult({error, response: null, isLoading: false}));
50
63
  }, [client, profileSource, metadata, reportType]);
51
64
 
52
65
  return result;
package/src/utils.ts CHANGED
@@ -1,3 +1,16 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
1
14
  import {QueryRequest, QueryRequest_ReportType, QueryServiceClient} from '@parca/client';
2
15
  import {RpcMetadata} from '@protobuf-ts/runtime-rpc';
3
16