@parca/profile 0.12.6 → 0.12.13

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,18 @@
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.12.13](https://github.com/parca-dev/parca/compare/ui-v0.12.12...ui-v0.12.13) (2022-04-05)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.12.12](https://github.com/parca-dev/parca/compare/ui-v0.12.11...ui-v0.12.12) (2022-04-05)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
14
+ ## [0.12.8](https://github.com/parca-dev/parca/compare/ui-v0.12.7...ui-v0.12.8) (2022-03-30)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
6
18
  ## [0.12.6](https://github.com/parca-dev/parca/compare/ui-v0.12.5...ui-v0.12.6) (2022-03-24)
7
19
 
8
20
  **Note:** Version bump only for package @parca/profile
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.12.6",
3
+ "version": "0.12.13",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
- "@parca/client": "^0.12.6",
6
+ "@parca/client": "^0.12.12",
7
7
  "@parca/dynamicsize": "^0.12.0",
8
8
  "@parca/parser": "^0.12.3",
9
9
  "d3-scale": "^4.0.2"
@@ -19,5 +19,5 @@
19
19
  "access": "public",
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
- "gitHead": "5ac2cede2384a48df3df2615bcccfaaf0f4933f5"
22
+ "gitHead": "d75d40dee66420f703879f7b572d5f14ec09cce8"
23
23
  }
@@ -2,12 +2,11 @@ import React, {useEffect, useState} from 'react';
2
2
  import {CalcWidth} from '@parca/dynamicsize';
3
3
  import {parseParams} from '@parca/functions';
4
4
  import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
5
- import {Button} from '@parca/components';
5
+ import {Button, Card, useGrpcMetadata} from '@parca/components';
6
6
  import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
7
7
 
8
8
  import ProfileIcicleGraph from './ProfileIcicleGraph';
9
9
  import {ProfileSource} from './ProfileSource';
10
- import {Card} from '@parca/components';
11
10
  import TopTable from './TopTable';
12
11
 
13
12
  import './ProfileView.styles.css';
@@ -18,6 +17,7 @@ interface ProfileViewProps {
18
17
  queryClient: QueryServiceClient;
19
18
  profileSource: ProfileSource;
20
19
  navigateTo?: NavigateFunction;
20
+ compare?: boolean;
21
21
  }
22
22
 
23
23
  export interface IQueryResult {
@@ -44,6 +44,7 @@ export const useQuery = (
44
44
  response: null,
45
45
  error: null,
46
46
  });
47
+ const metadata = useGrpcMetadata();
47
48
 
48
49
  useEffect(() => {
49
50
  setResult({
@@ -53,13 +54,17 @@ export const useQuery = (
53
54
  const req = profileSource.QueryRequest();
54
55
  req.setReportType(QueryRequest.ReportType.REPORT_TYPE_FLAMEGRAPH_UNSPECIFIED);
55
56
 
56
- client.query(req, (error: ServiceError | null, responseMessage: QueryResponse | null) => {
57
- setResult({
58
- isLoading: false,
59
- response: responseMessage,
60
- error: error,
61
- });
62
- });
57
+ client.query(
58
+ req,
59
+ metadata,
60
+ (error: ServiceError | null, responseMessage: QueryResponse | null) => {
61
+ setResult({
62
+ isLoading: false,
63
+ response: responseMessage,
64
+ error: error,
65
+ });
66
+ }
67
+ );
63
68
  }, [client, profileSource]);
64
69
 
65
70
  return result;
@@ -76,6 +81,7 @@ export const ProfileView = ({
76
81
  const [isLoaderVisible, setIsLoaderVisible] = useState<boolean>(false);
77
82
  const {isLoading, response, error} = useQuery(queryClient, profileSource);
78
83
  const [currentView, setCurrentView] = useState<string | undefined>(currentViewFromURL);
84
+ const grpcMetadata = useGrpcMetadata();
79
85
 
80
86
  useEffect(() => {
81
87
  let showLoaderTimeout;
@@ -138,6 +144,7 @@ export const ProfileView = ({
138
144
 
139
145
  queryClient.query(
140
146
  req,
147
+ grpcMetadata,
141
148
  (
142
149
  error: ServiceError | null,
143
150
  responseMessage: parca_query_v1alpha1_query_pb.QueryResponse | null
package/src/TopTable.tsx CHANGED
@@ -1,6 +1,4 @@
1
1
  import React, {useEffect, useState} from 'react';
2
-
3
- import {ProfileSource} from './ProfileSource';
4
2
  import {
5
3
  QueryRequest,
6
4
  QueryResponse,
@@ -10,7 +8,9 @@ import {
10
8
  } from '@parca/client';
11
9
  import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
12
10
  import {getLastItem, valueFormatter} from '@parca/functions';
11
+ import {useGrpcMetadata} from '@parca/components';
13
12
 
13
+ import {ProfileSource} from './ProfileSource';
14
14
  import './TopTable.styles.css';
15
15
 
16
16
  interface ProfileViewProps {
@@ -90,6 +90,7 @@ export const useQuery = (
90
90
  response: null,
91
91
  error: null,
92
92
  });
93
+ const metadata = useGrpcMetadata();
93
94
 
94
95
  useEffect(() => {
95
96
  const req = profileSource.QueryRequest();
@@ -97,6 +98,7 @@ export const useQuery = (
97
98
 
98
99
  client.query(
99
100
  req,
101
+ metadata,
100
102
  (
101
103
  error: ServiceError | null,
102
104
  responseMessage: parca_query_v1alpha1_query_pb.QueryResponse | null
@@ -187,6 +189,15 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
187
189
  <Arrow direction={getClassNamesFor('cumulative')} />
188
190
  </span>
189
191
  </th>
192
+ <th
193
+ className="text-right text-sm cursor-pointer pt-2 pb-2 pr-2"
194
+ onClick={() => requestSort('diff')}
195
+ >
196
+ Diff
197
+ <span className={`inline-block align-middle ml-2 ${getClassNamesFor('diff')}`}>
198
+ <Arrow direction={getClassNamesFor('diff')} />
199
+ </span>
200
+ </th>
190
201
  </tr>
191
202
  </thead>
192
203
  <tbody className="bg-white divide-y divide-gray-200 dark:bg-gray-900 dark:divide-gray-700">
@@ -195,12 +206,15 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
195
206
  <td className="text-xs py-1.5 pl-2 min-w-[150px] max-w-[450px]">
196
207
  {RowLabel(report.meta)}
197
208
  </td>
198
- <td className="text-xs min-w-[150px] max-w-[150px] py-1.5text-right">
209
+ <td className="text-xs min-w-[150px] max-w-[150px] py-1.5 text-right">
199
210
  {valueFormatter(report.flat, unit, 2)}
200
211
  </td>
201
212
  <td className="text-xs min-w-[150px] max-w-[150px] py-1.5 text-right pr-2">
202
213
  {valueFormatter(report.cumulative, unit, 2)}
203
214
  </td>
215
+ <td className="text-xs min-w-[150px] max-w-[150px] py-1.5 text-right pr-2">
216
+ {valueFormatter(report.diff, unit, 2)}
217
+ </td>
204
218
  </tr>
205
219
  ))}
206
220
  </tbody>