@parca/profile 0.16.394 → 0.16.395
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 +4 -0
- package/dist/Callgraph/index.d.ts +0 -1
- package/dist/GraphTooltip/ExpandOnHoverValue.d.ts +0 -1
- package/dist/GraphTooltip/index.d.ts +0 -1
- package/dist/GraphTooltipArrow/DockedGraphTooltip/index.d.ts +0 -1
- package/dist/GraphTooltipArrow/ExpandOnHoverValue.d.ts +0 -1
- package/dist/MatchersInput/SuggestionItem.d.ts +0 -1
- package/dist/MatchersInput/SuggestionsList.d.ts +0 -1
- package/dist/MatchersInput/index.d.ts +0 -1
- package/dist/MetricsCircle/index.d.ts +0 -1
- package/dist/MetricsGraph/MetricsContextMenu/index.d.ts +0 -1
- package/dist/MetricsGraph/MetricsInfoPanel/index.d.ts +0 -1
- package/dist/MetricsGraph/MetricsTooltip/index.d.ts +0 -1
- package/dist/MetricsGraph/index.d.ts +0 -1
- package/dist/MetricsSeries/index.d.ts +0 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +0 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +0 -1
- package/dist/ProfileExplorer/index.d.ts +0 -1
- package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.d.ts +0 -1
- package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +0 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts +0 -1
- package/dist/ProfileMetricsGraph/index.d.ts +0 -1
- package/dist/ProfileMetricsGraph/index.js +6 -13
- package/dist/ProfileSelector/CompareButton.d.ts +0 -1
- package/dist/ProfileSelector/index.d.ts +0 -1
- package/dist/ProfileSource.d.ts +0 -1
- package/dist/ProfileTypeSelector/index.d.ts +0 -1
- package/dist/ProfileView/FilterByFunctionButton.d.ts +0 -1
- package/dist/ProfileView/ViewSelector.d.ts +0 -1
- package/dist/ProfileView/index.d.ts +0 -1
- package/dist/ProfileViewWithData.d.ts +0 -1
- package/dist/SourceView/LineNo.d.ts +0 -1
- package/dist/components/DiffLegend.d.ts +0 -1
- package/dist/components/ProfileShareButton/ResultBox.d.ts +0 -1
- package/dist/components/ProfileShareButton/index.d.ts +0 -1
- package/package.json +2 -2
- package/src/ProfileMetricsGraph/index.tsx +5 -36
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.395 (2024-07-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.16.394](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.393...@parca/profile@0.16.394) (2024-06-27)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CallgraphNode, CallgraphNodeMeta, FlamegraphNode, FlamegraphNodeMeta, FlamegraphRootNode } from '@parca/client';
|
|
3
2
|
import { Location, Mapping, Function as ParcaFunction } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
|
|
4
3
|
interface ExtendedCallgraphNodeMeta extends CallgraphNodeMeta {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// Copyright 2022 The Parca Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -17,19 +17,17 @@ import { Duration, Timestamp } from '@parca/client';
|
|
|
17
17
|
import { MetricsGraphSkeleton, useGrpcMetadata, useParcaContext, } from '@parca/components';
|
|
18
18
|
import { Query } from '@parca/parser';
|
|
19
19
|
import { capitalizeOnlyFirstLetter, getStepDuration } from '@parca/utilities';
|
|
20
|
-
import { useLabelNames } from '../MatchersInput';
|
|
21
20
|
import MetricsGraph from '../MetricsGraph';
|
|
22
21
|
import { useMetricsGraphDimensions } from '../MetricsGraph/useMetricsGraphDimensions';
|
|
23
22
|
import useDelayedLoader from '../useDelayedLoader';
|
|
24
|
-
import { Toolbar } from './Toolbar';
|
|
25
|
-
import { useSumBy } from './useSumBy';
|
|
26
23
|
const ErrorContent = ({ errorMessage }) => {
|
|
27
24
|
return (_jsx("div", { className: "relative rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700", role: "alert", children: _jsx("span", { className: "block sm:inline", children: errorMessage }) }));
|
|
28
25
|
};
|
|
29
26
|
export const ProfileMetricsEmptyState = ({ message }) => {
|
|
30
27
|
return (_jsx("div", { className: "flex h-full w-full flex-col items-center justify-center", children: _jsx("p", { children: message }) }));
|
|
31
28
|
};
|
|
32
|
-
|
|
29
|
+
const EMPTY_SUM_BY = [];
|
|
30
|
+
export const useQueryRange = (client, queryExpression, start, end, sumBy = EMPTY_SUM_BY, skip = false) => {
|
|
33
31
|
const [isLoading, setLoading] = useState(!skip);
|
|
34
32
|
const [state, setState] = useState({
|
|
35
33
|
response: null,
|
|
@@ -67,9 +65,7 @@ export const useQueryRange = (client, queryExpression, start, end, sumBy = [], s
|
|
|
67
65
|
return { ...state, isLoading };
|
|
68
66
|
};
|
|
69
67
|
const ProfileMetricsGraph = ({ queryClient, queryExpression, profile, from, to, setTimeRange, addLabelMatcher, onPointClick, comparing = false, }) => {
|
|
70
|
-
const {
|
|
71
|
-
const [sumBy, setSumBy] = useSumBy(profile?.ProfileSource()?.ProfileType(), labelNamesResult.response?.labelNames);
|
|
72
|
-
const { isLoading, response, error } = useQueryRange(queryClient, queryExpression, from, to, sumBy, labelNamesLoading);
|
|
68
|
+
const { isLoading, response, error } = useQueryRange(queryClient, queryExpression, from, to);
|
|
73
69
|
const isLoaderVisible = useDelayedLoader(isLoading);
|
|
74
70
|
const { onError, perf, authenticationErrorMessage, isDarkMode } = useParcaContext();
|
|
75
71
|
const { width, height, margin, heightStyle } = useMetricsGraphDimensions(comparing);
|
|
@@ -86,7 +82,7 @@ const ProfileMetricsGraph = ({ queryClient, queryExpression, profile, from, to,
|
|
|
86
82
|
}, [perf, response]);
|
|
87
83
|
const series = response?.series;
|
|
88
84
|
const dataAvailable = series !== null && series !== undefined && series?.length > 0;
|
|
89
|
-
const metricsGraphLoading = isLoaderVisible || (isLoading && !dataAvailable
|
|
85
|
+
const metricsGraphLoading = isLoaderVisible || (isLoading && !dataAvailable);
|
|
90
86
|
if (metricsGraphLoading) {
|
|
91
87
|
return _jsx(MetricsGraphSkeleton, { heightStyle: heightStyle, isDarkMode: isDarkMode });
|
|
92
88
|
}
|
|
@@ -96,9 +92,6 @@ const ProfileMetricsGraph = ({ queryClient, queryExpression, profile, from, to,
|
|
|
96
92
|
}
|
|
97
93
|
return _jsx(ErrorContent, { errorMessage: capitalizeOnlyFirstLetter(error.message) });
|
|
98
94
|
}
|
|
99
|
-
if (!labelNamesLoading && labelNamesResult?.error != null) {
|
|
100
|
-
return (_jsx(ErrorContent, { errorMessage: capitalizeOnlyFirstLetter(labelNamesResult.error.message) }));
|
|
101
|
-
}
|
|
102
95
|
if (dataAvailable) {
|
|
103
96
|
const handleSampleClick = (timestamp, _value, labels, duration) => {
|
|
104
97
|
onPointClick(timestamp, labels, queryExpression, duration);
|
|
@@ -110,7 +103,7 @@ const ProfileMetricsGraph = ({ queryClient, queryExpression, profile, from, to,
|
|
|
110
103
|
if (sampleUnit === '') {
|
|
111
104
|
sampleUnit = Query.parse(queryExpression).profileType().sampleUnit;
|
|
112
105
|
}
|
|
113
|
-
return (_jsx(AnimatePresence, { children:
|
|
106
|
+
return (_jsx(AnimatePresence, { children: _jsx(motion.div, { className: "h-full w-full relative", initial: { display: 'none', opacity: 0 }, animate: { display: 'block', opacity: 1 }, transition: { duration: 0.5 }, children: _jsx(MetricsGraph, { data: series, from: from, to: to, profile: profile, setTimeRange: setTimeRange, onSampleClick: handleSampleClick, addLabelMatcher: addLabelMatcher, sampleUnit: sampleUnit, height: height, width: width, margin: margin }) }, "metrics-graph-loaded") }));
|
|
114
107
|
}
|
|
115
108
|
return _jsx(ProfileMetricsEmptyState, { message: "No data found. Try a different query." });
|
|
116
109
|
};
|
package/dist/ProfileSource.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Callgraph as CallgraphType, Flamegraph, FlamegraphArrow, QueryServiceClient, Source, TableArrow, Top } from '@parca/client';
|
|
3
2
|
import { ProfileSource } from '../ProfileSource';
|
|
4
3
|
type NavigateFunction = (path: string, queryParams: any, options?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.395",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@headlessui/react": "^1.7.19",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"access": "public",
|
|
74
74
|
"registry": "https://registry.npmjs.org/"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "93b2cfe8be8c6ffea045131594c8f6f5784bdfdc"
|
|
77
77
|
}
|
|
@@ -27,12 +27,9 @@ import {Query} from '@parca/parser';
|
|
|
27
27
|
import {capitalizeOnlyFirstLetter, getStepDuration} from '@parca/utilities';
|
|
28
28
|
|
|
29
29
|
import {MergedProfileSelection, ProfileSelection} from '..';
|
|
30
|
-
import {useLabelNames} from '../MatchersInput';
|
|
31
30
|
import MetricsGraph from '../MetricsGraph';
|
|
32
31
|
import {useMetricsGraphDimensions} from '../MetricsGraph/useMetricsGraphDimensions';
|
|
33
32
|
import useDelayedLoader from '../useDelayedLoader';
|
|
34
|
-
import {Toolbar} from './Toolbar';
|
|
35
|
-
import {useSumBy} from './useSumBy';
|
|
36
33
|
|
|
37
34
|
interface ProfileMetricsEmptyStateProps {
|
|
38
35
|
message: string;
|
|
@@ -82,12 +79,14 @@ export interface IQueryRangeState {
|
|
|
82
79
|
error: RpcError | null;
|
|
83
80
|
}
|
|
84
81
|
|
|
82
|
+
const EMPTY_SUM_BY: string[] = [];
|
|
83
|
+
|
|
85
84
|
export const useQueryRange = (
|
|
86
85
|
client: QueryServiceClient,
|
|
87
86
|
queryExpression: string,
|
|
88
87
|
start: number,
|
|
89
88
|
end: number,
|
|
90
|
-
sumBy: string[] =
|
|
89
|
+
sumBy: string[] = EMPTY_SUM_BY,
|
|
91
90
|
skip = false
|
|
92
91
|
): IQueryRangeState => {
|
|
93
92
|
const [isLoading, setLoading] = useState<boolean>(!skip);
|
|
@@ -145,25 +144,7 @@ const ProfileMetricsGraph = ({
|
|
|
145
144
|
onPointClick,
|
|
146
145
|
comparing = false,
|
|
147
146
|
}: ProfileMetricsGraphProps): JSX.Element => {
|
|
148
|
-
const {
|
|
149
|
-
queryClient,
|
|
150
|
-
from,
|
|
151
|
-
to,
|
|
152
|
-
profile?.ProfileSource()?.ProfileType()?.toString()
|
|
153
|
-
);
|
|
154
|
-
const [sumBy, setSumBy] = useSumBy(
|
|
155
|
-
profile?.ProfileSource()?.ProfileType(),
|
|
156
|
-
labelNamesResult.response?.labelNames
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const {isLoading, response, error} = useQueryRange(
|
|
160
|
-
queryClient,
|
|
161
|
-
queryExpression,
|
|
162
|
-
from,
|
|
163
|
-
to,
|
|
164
|
-
sumBy,
|
|
165
|
-
labelNamesLoading
|
|
166
|
-
);
|
|
147
|
+
const {isLoading, response, error} = useQueryRange(queryClient, queryExpression, from, to);
|
|
167
148
|
const isLoaderVisible = useDelayedLoader(isLoading);
|
|
168
149
|
const {onError, perf, authenticationErrorMessage, isDarkMode} = useParcaContext();
|
|
169
150
|
const {width, height, margin, heightStyle} = useMetricsGraphDimensions(comparing);
|
|
@@ -185,8 +166,7 @@ const ProfileMetricsGraph = ({
|
|
|
185
166
|
const series = response?.series;
|
|
186
167
|
const dataAvailable = series !== null && series !== undefined && series?.length > 0;
|
|
187
168
|
|
|
188
|
-
const metricsGraphLoading =
|
|
189
|
-
isLoaderVisible || (isLoading && !dataAvailable && !labelNamesLoading);
|
|
169
|
+
const metricsGraphLoading = isLoaderVisible || (isLoading && !dataAvailable);
|
|
190
170
|
|
|
191
171
|
if (metricsGraphLoading) {
|
|
192
172
|
return <MetricsGraphSkeleton heightStyle={heightStyle} isDarkMode={isDarkMode} />;
|
|
@@ -200,12 +180,6 @@ const ProfileMetricsGraph = ({
|
|
|
200
180
|
return <ErrorContent errorMessage={capitalizeOnlyFirstLetter(error.message)} />;
|
|
201
181
|
}
|
|
202
182
|
|
|
203
|
-
if (!labelNamesLoading && labelNamesResult?.error != null) {
|
|
204
|
-
return (
|
|
205
|
-
<ErrorContent errorMessage={capitalizeOnlyFirstLetter(labelNamesResult.error.message)} />
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
183
|
if (dataAvailable) {
|
|
210
184
|
const handleSampleClick = (
|
|
211
185
|
timestamp: number,
|
|
@@ -233,11 +207,6 @@ const ProfileMetricsGraph = ({
|
|
|
233
207
|
animate={{display: 'block', opacity: 1}}
|
|
234
208
|
transition={{duration: 0.5}}
|
|
235
209
|
>
|
|
236
|
-
<Toolbar
|
|
237
|
-
sumBy={sumBy}
|
|
238
|
-
setSumBy={setSumBy}
|
|
239
|
-
labels={labelNamesResult.response?.labelNames ?? []}
|
|
240
|
-
/>
|
|
241
210
|
<MetricsGraph
|
|
242
211
|
data={series}
|
|
243
212
|
from={from}
|