@parca/profile 0.19.68 → 0.19.69

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.19.69](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.68...@parca/profile@0.19.69) (2025-10-21)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.19.68](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.67...@parca/profile@0.19.68) (2025-10-21)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -64,7 +64,7 @@ export interface IProfileTypesResult {
64
64
  data?: ProfileTypesResponse;
65
65
  error?: RpcError;
66
66
  }
67
- export declare const useProfileTypes: (client: QueryServiceClient) => IProfileTypesResult;
67
+ export declare const useProfileTypes: (client: QueryServiceClient, start?: number, end?: number) => IProfileTypesResult;
68
68
  declare const ProfileSelector: ({ queryClient, querySelection, selectProfile, selectQuery, closeProfile, enforcedProfileName, profileSelection, comparing, navigateTo, showMetricsGraph, showSumBySelector, showProfileTypeSelector, disableExplorativeQuerying, setDisplayHideMetricsGraphButton, utilizationMetrics, utilizationMetricsLoading, utilizationLabels, onUtilizationSeriesSelect, }: ProfileSelectorProps) => JSX.Element;
69
69
  export default ProfileSelector;
70
70
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileSelector/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAC;AAErF,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAWvE,OAAO,EAAC,KAAK,gBA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icons';
17
17
  import { Query } from '@parca/parser';
18
18
  import { TEST_IDS, testId } from '@parca/test-utils';
19
+ import { millisToProtoTimestamp } from '@parca/utilities';
19
20
  import { useLabelNames } from '../MatchersInput/index';
20
21
  import { useMetricsGraphDimensions } from '../MetricsGraph/useMetricsGraphDimensions';
21
22
  import { UtilizationLabelsProvider } from '../contexts/UtilizationLabelsContext';
23
+ import useGrpcQuery from '../useGrpcQuery';
22
24
  import { useDefaultSumBy, useSumBySelection } from '../useSumBy';
23
25
  import { MetricsGraphSection } from './MetricsGraphSection';
24
26
  import { QueryControls } from './QueryControls';
25
27
  import { useAutoQuerySelector } from './useAutoQuerySelector';
26
- export const useProfileTypes = (client) => {
27
- const [result, setResult] = useState(undefined);
28
- const [error, setError] = useState(undefined);
29
- const [loading, setLoading] = useState(true);
28
+ export const useProfileTypes = (client, start, end) => {
30
29
  const metadata = useGrpcMetadata();
31
- useEffect(() => {
32
- if (!loading) {
33
- return;
34
- }
35
- const call = client.profileTypes({}, { meta: metadata });
36
- call.response
37
- .then(response => setResult(response))
38
- .catch(error => setError(error))
39
- .finally(() => setLoading(false));
40
- }, [client, metadata, loading]);
41
- return { loading, data: result, error };
30
+ const metadataString = useMemo(() => JSON.stringify(metadata), [metadata]);
31
+ const request = {};
32
+ if (start != null && end != null) {
33
+ request.start = millisToProtoTimestamp(start);
34
+ request.end = millisToProtoTimestamp(end);
35
+ }
36
+ const { isLoading, data, error } = useGrpcQuery({
37
+ key: ['profileTypes', metadataString, start, end],
38
+ queryFn: async (abort) => {
39
+ const { response } = await client.profileTypes(request, {
40
+ meta: metadata,
41
+ abort,
42
+ });
43
+ return response;
44
+ },
45
+ });
46
+ return { loading: isLoading, data, error: error };
42
47
  };
43
48
  const ProfileSelector = ({ queryClient, querySelection, selectProfile, selectQuery, closeProfile, enforcedProfileName, profileSelection, comparing, navigateTo, showMetricsGraph = true, showSumBySelector = true, showProfileTypeSelector = true, disableExplorativeQuerying = false, setDisplayHideMetricsGraphButton, utilizationMetrics, utilizationMetricsLoading, utilizationLabels, onUtilizationSeriesSelect, }) => {
44
- const { loading: profileTypesLoading, data: profileTypesData, error, } = useProfileTypes(queryClient);
45
49
  const { heightStyle } = useMetricsGraphDimensions(comparing, utilizationMetrics != null);
46
50
  const { viewComponent } = useParcaContext();
47
51
  const [queryBrowserMode, setQueryBrowserMode] = useURLState('query_browser_mode');
@@ -56,6 +60,7 @@ const ProfileSelector = ({ queryClient, querySelection, selectProfile, selectQue
56
60
  }, [querySelection.expression]);
57
61
  const from = timeRangeSelection.getFromMs();
58
62
  const to = timeRangeSelection.getToMs();
63
+ const { loading: profileTypesLoading, data: profileTypesData, error, } = useProfileTypes(queryClient, from, to);
59
64
  const { loading: labelNamesLoading, result, refetch, } = useLabelNames(queryClient, profileType.toString(), from, to);
60
65
  const { loading: selectedLabelNamesLoading, result: selectedLabelNamesResult } = useLabelNames(queryClient, selectedProfileType.toString(), from, to);
61
66
  const labels = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"useHasProfileData.d.ts","sourceRoot":"","sources":["../src/useHasProfileData.ts"],"names":[],"mappings":"AAaA,OAAO,EAAyB,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIzE,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,kBAAkB,KACzB;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAA;CAUtD,CAAC"}
1
+ {"version":3,"file":"useHasProfileData.d.ts","sourceRoot":"","sources":["../src/useHasProfileData.ts"],"names":[],"mappings":"AAeA,OAAO,EAAyB,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAKzE,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,kBAAkB,KACzB;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAA;CAatD,CAAC"}
@@ -10,12 +10,16 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ import { useMemo } from 'react';
14
+ import { useGrpcMetadata } from '@parca/components';
13
15
  import useGrpcQuery from './useGrpcQuery';
14
16
  export const useHasProfileData = (client) => {
17
+ const metadata = useGrpcMetadata();
18
+ const metadataString = useMemo(() => JSON.stringify(metadata), [metadata]);
15
19
  const { data, isLoading, error } = useGrpcQuery({
16
- key: ['hasProfileData'],
20
+ key: ['hasProfileData', metadataString],
17
21
  queryFn: async (signal) => {
18
- const { response } = await client.hasProfileData({}, { abort: signal });
22
+ const { response } = await client.hasProfileData({}, { abort: signal, meta: metadata });
19
23
  return response;
20
24
  },
21
25
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.19.68",
3
+ "version": "0.19.69",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@floating-ui/react": "^0.27.12",
@@ -79,5 +79,5 @@
79
79
  "access": "public",
80
80
  "registry": "https://registry.npmjs.org/"
81
81
  },
82
- "gitHead": "e7f9b84b1252abd82724195295e833a69adc2a4a"
82
+ "gitHead": "0e560384dab008296284eb1daed2d89042a65540"
83
83
  }
@@ -15,7 +15,7 @@ import {Dispatch, SetStateAction, useEffect, useMemo, useRef, useState} from 're
15
15
 
16
16
  import {RpcError} from '@protobuf-ts/runtime-rpc';
17
17
 
18
- import {ProfileTypesResponse, QueryServiceClient} from '@parca/client';
18
+ import {ProfileTypesRequest, ProfileTypesResponse, QueryServiceClient} from '@parca/client';
19
19
  import {
20
20
  DateTimeRange,
21
21
  IconButton,
@@ -26,12 +26,13 @@ import {
26
26
  import {CloseIcon} from '@parca/icons';
27
27
  import {Query} from '@parca/parser';
28
28
  import {TEST_IDS, testId} from '@parca/test-utils';
29
- import {type NavigateFunction} from '@parca/utilities';
29
+ import {millisToProtoTimestamp, type NavigateFunction} from '@parca/utilities';
30
30
 
31
31
  import {ProfileSelection} from '..';
32
32
  import {useLabelNames} from '../MatchersInput/index';
33
33
  import {useMetricsGraphDimensions} from '../MetricsGraph/useMetricsGraphDimensions';
34
34
  import {UtilizationLabelsProvider} from '../contexts/UtilizationLabelsContext';
35
+ import useGrpcQuery from '../useGrpcQuery';
35
36
  import {useDefaultSumBy, useSumBySelection} from '../useSumBy';
36
37
  import {MetricsGraphSection} from './MetricsGraphSection';
37
38
  import {QueryControls} from './QueryControls';
@@ -104,24 +105,32 @@ export interface IProfileTypesResult {
104
105
  error?: RpcError;
105
106
  }
106
107
 
107
- export const useProfileTypes = (client: QueryServiceClient): IProfileTypesResult => {
108
- const [result, setResult] = useState<ProfileTypesResponse | undefined>(undefined);
109
- const [error, setError] = useState<RpcError | undefined>(undefined);
110
- const [loading, setLoading] = useState(true);
108
+ export const useProfileTypes = (
109
+ client: QueryServiceClient,
110
+ start?: number,
111
+ end?: number
112
+ ): IProfileTypesResult => {
111
113
  const metadata = useGrpcMetadata();
114
+ const metadataString = useMemo(() => JSON.stringify(metadata), [metadata]);
115
+ const request: ProfileTypesRequest = {};
116
+
117
+ if (start != null && end != null) {
118
+ request.start = millisToProtoTimestamp(start);
119
+ request.end = millisToProtoTimestamp(end);
120
+ }
121
+
122
+ const {isLoading, data, error} = useGrpcQuery({
123
+ key: ['profileTypes', metadataString, start, end],
124
+ queryFn: async abort => {
125
+ const {response} = await client.profileTypes(request, {
126
+ meta: metadata,
127
+ abort,
128
+ });
129
+ return response;
130
+ },
131
+ });
112
132
 
113
- useEffect(() => {
114
- if (!loading) {
115
- return;
116
- }
117
- const call = client.profileTypes({}, {meta: metadata});
118
- call.response
119
- .then(response => setResult(response))
120
- .catch(error => setError(error))
121
- .finally(() => setLoading(false));
122
- }, [client, metadata, loading]);
123
-
124
- return {loading, data: result, error};
133
+ return {loading: isLoading, data, error: error as RpcError};
125
134
  };
126
135
 
127
136
  const ProfileSelector = ({
@@ -144,11 +153,6 @@ const ProfileSelector = ({
144
153
  utilizationLabels,
145
154
  onUtilizationSeriesSelect,
146
155
  }: ProfileSelectorProps): JSX.Element => {
147
- const {
148
- loading: profileTypesLoading,
149
- data: profileTypesData,
150
- error,
151
- } = useProfileTypes(queryClient);
152
156
  const {heightStyle} = useMetricsGraphDimensions(comparing, utilizationMetrics != null);
153
157
  const {viewComponent} = useParcaContext();
154
158
  const [queryBrowserMode, setQueryBrowserMode] = useURLState('query_browser_mode');
@@ -174,6 +178,12 @@ const ProfileSelector = ({
174
178
  const from = timeRangeSelection.getFromMs();
175
179
  const to = timeRangeSelection.getToMs();
176
180
 
181
+ const {
182
+ loading: profileTypesLoading,
183
+ data: profileTypesData,
184
+ error,
185
+ } = useProfileTypes(queryClient, from, to);
186
+
177
187
  const {
178
188
  loading: labelNamesLoading,
179
189
  result,
@@ -11,17 +11,23 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
+ import {useMemo} from 'react';
15
+
14
16
  import {HasProfileDataResponse, QueryServiceClient} from '@parca/client';
17
+ import {useGrpcMetadata} from '@parca/components';
15
18
 
16
19
  import useGrpcQuery from './useGrpcQuery';
17
20
 
18
21
  export const useHasProfileData = (
19
22
  client: QueryServiceClient
20
23
  ): {loading: boolean; data: boolean; error: Error | any} => {
24
+ const metadata = useGrpcMetadata();
25
+ const metadataString = useMemo(() => JSON.stringify(metadata), [metadata]);
26
+
21
27
  const {data, isLoading, error} = useGrpcQuery<HasProfileDataResponse>({
22
- key: ['hasProfileData'],
28
+ key: ['hasProfileData', metadataString],
23
29
  queryFn: async signal => {
24
- const {response} = await client.hasProfileData({}, {abort: signal});
30
+ const {response} = await client.hasProfileData({}, {abort: signal, meta: metadata});
25
31
  return response;
26
32
  },
27
33
  });