@parca/profile 0.16.485 → 0.16.487
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 +8 -0
- package/dist/MetricsGraph/UtilizationMetrics/index.d.ts +3 -1
- package/dist/MetricsGraph/UtilizationMetrics/index.d.ts.map +1 -1
- package/dist/MetricsGraph/UtilizationMetrics/index.js +18 -6
- package/dist/ProfileSelector/MetricsGraphSection.d.ts +5 -1
- package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
- package/dist/ProfileSelector/MetricsGraphSection.js +1 -1
- package/dist/ProfileSelector/index.d.ts +5 -1
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +3 -1
- package/dist/SimpleMatchers/Select.d.ts.map +1 -1
- package/dist/SimpleMatchers/Select.js +9 -1
- package/package.json +8 -6
- package/src/MetricsGraph/UtilizationMetrics/index.tsx +24 -3
- package/src/ProfileSelector/MetricsGraphSection.tsx +18 -7
- package/src/ProfileSelector/index.tsx +11 -3
- package/src/SimpleMatchers/Select.tsx +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.487](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.486...@parca/profile@0.16.487) (2025-03-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.486](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.485...@parca/profile@0.16.486) (2025-03-12)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.16.485](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.484...@parca/profile@0.16.485) (2025-03-05)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -10,6 +10,8 @@ interface CommonProps {
|
|
|
10
10
|
value: string;
|
|
11
11
|
}>) => void;
|
|
12
12
|
setTimeRange: (range: DateTimeRange) => void;
|
|
13
|
+
name: string;
|
|
14
|
+
humanReadableName: string;
|
|
13
15
|
}
|
|
14
16
|
type Props = CommonProps & {
|
|
15
17
|
data: MetricSeries[];
|
|
@@ -23,6 +25,6 @@ type Props = CommonProps & {
|
|
|
23
25
|
setTimeRange: (range: DateTimeRange) => void;
|
|
24
26
|
utilizationMetricsLoading?: boolean;
|
|
25
27
|
};
|
|
26
|
-
declare const UtilizationMetrics: ({ data, addLabelMatcher, setTimeRange, utilizationMetricsLoading, }: Props) => JSX.Element;
|
|
28
|
+
declare const UtilizationMetrics: ({ data, addLabelMatcher, setTimeRange, utilizationMetricsLoading, name, humanReadableName, }: Props) => JSX.Element;
|
|
27
29
|
export default UtilizationMetrics;
|
|
28
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAqD,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAC,KAAK,kBAAkB,IAAI,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAM9E,UAAU,WAAW;IACnB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAqD,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAC,KAAK,kBAAkB,IAAI,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAM9E,UAAU,WAAW;IACnB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAQD,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAsdF,QAAA,MAAM,kBAAkB,iGAOrB,KAAK,KAAG,GAAG,CAAC,OA8Bd,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -46,7 +46,19 @@ function transformToSeries(data) {
|
|
|
46
46
|
values: series.values.sort((a, b) => a[0] - b[0]),
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const getYAxisUnit = (name) => {
|
|
50
|
+
switch (name) {
|
|
51
|
+
case 'gpu_utilization_percent':
|
|
52
|
+
return 'percent';
|
|
53
|
+
case 'gpu_memory_utilization_percent':
|
|
54
|
+
return 'percent';
|
|
55
|
+
case 'gpu_power_watt':
|
|
56
|
+
return 'watts';
|
|
57
|
+
default:
|
|
58
|
+
return 'percent';
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, height, margin, name, humanReadableName, }) => {
|
|
50
62
|
const { timezone } = useParcaContext();
|
|
51
63
|
const graph = useRef(null);
|
|
52
64
|
const [dragging, setDragging] = useState(false);
|
|
@@ -194,7 +206,7 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
|
|
|
194
206
|
e.stopPropagation();
|
|
195
207
|
e.preventDefault();
|
|
196
208
|
};
|
|
197
|
-
return (_jsxs(_Fragment, { children: [_jsx(MetricsContextMenu, { onAddLabelMatcher: addLabelMatcher, menuId: MENU_ID, highlighted: highlighted, trackVisibility: trackVisibility, utilizationMetrics: true }), highlighted != null && hovering && !dragging && pos[0] !== 0 && pos[1] !== 0 && (_jsx("div", { onMouseMove: onMouseMove, onMouseEnter: () => setHovering(true), onMouseLeave: () => setHovering(false), children: !isContextMenuOpen && (_jsx(MetricsTooltip, { x: pos[0] + margin, y: pos[1] + margin, highlighted: highlighted, contextElement: graph.current, sampleUnit:
|
|
209
|
+
return (_jsxs(_Fragment, { children: [_jsx(MetricsContextMenu, { onAddLabelMatcher: addLabelMatcher, menuId: MENU_ID, highlighted: highlighted, trackVisibility: trackVisibility, utilizationMetrics: true }), highlighted != null && hovering && !dragging && pos[0] !== 0 && pos[1] !== 0 && (_jsx("div", { onMouseMove: onMouseMove, onMouseEnter: () => setHovering(true), onMouseLeave: () => setHovering(false), children: !isContextMenuOpen && (_jsx(MetricsTooltip, { x: pos[0] + margin, y: pos[1] + margin, highlighted: highlighted, contextElement: graph.current, sampleUnit: getYAxisUnit(name), delta: false, utilizationMetrics: true })) })), _jsx("div", { ref: graph, onMouseEnter: function () {
|
|
198
210
|
setHovering(true);
|
|
199
211
|
}, onMouseLeave: () => setHovering(false), onContextMenu: displayMenu, children: _jsxs("svg", { width: `${width}px`, height: `${height + margin}px`, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onMouseMove: onMouseMove, children: [_jsx("g", { transform: `translate(${margin}, 0)`, children: dragging && (_jsx("g", { className: "zoom-time-rect", children: _jsx("rect", { className: "bar", x: pos[0] - relPos < 0 ? pos[0] : relPos, y: 0, height: height, width: Math.abs(pos[0] - relPos), fill: 'rgba(0, 0, 0, 0.125)' }) })) }), _jsxs("g", { transform: `translate(${margin * 1.5}, ${margin / 1.5})`, children: [_jsxs("g", { className: "y axis", textAnchor: "end", fontSize: "10", fill: "none", children: [yScale.ticks(3).map((d, i, allTicks) => {
|
|
200
212
|
let decimals = 2;
|
|
@@ -205,8 +217,8 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
|
|
|
205
217
|
}
|
|
206
218
|
return (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
|
|
207
219
|
/* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
|
|
208
|
-
transform: `translate(0, ${yScale(d)})`, children: [_jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x2: -6 }), _jsx("text", { fill: "currentColor", x: -9, dy: '0.32em', children: valueFormatter(d,
|
|
209
|
-
}), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: 0, y1: 0, y2: height - margin }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(to), x2: xScale(to), y1: 0, y2: height - margin }), _jsx("g", { transform: `translate(${-margin}, ${(height - margin) / 2}) rotate(270)`, children: _jsx("text", { fill: "currentColor", dy: "-0.7em", className: "text-sm capitalize", textAnchor: "middle", children:
|
|
220
|
+
transform: `translate(0, ${yScale(d)})`, children: [_jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x2: -6 }), _jsx("text", { fill: "currentColor", x: -9, dy: '0.32em', children: valueFormatter(d, getYAxisUnit(name), decimals) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(from), x2: xScale(to), y1: yScale(d), y2: yScale(d) }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`));
|
|
221
|
+
}), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: 0, y1: 0, y2: height - margin }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(to), x2: xScale(to), y1: 0, y2: height - margin }), _jsx("g", { transform: `translate(${-margin}, ${(height - margin) / 2}) rotate(270)`, children: _jsx("text", { fill: "currentColor", dy: "-0.7em", className: "text-sm capitalize", textAnchor: "middle", children: humanReadableName }) })] }), _jsxs("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: [xScale.ticks(5).map((d, i) => (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
|
|
210
222
|
/* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
|
|
211
223
|
transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, className: "stroke-gray-300 dark:stroke-gray-500" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to), timezone) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: graphWidth, y1: 0, y2: 0 }), _jsx("g", { transform: `translate(${(width - 2.5 * margin) / 2}, ${margin / 2})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 5, className: "text-sm", children: "Time" }) })] }), _jsx("g", { className: "lines fill-transparent", children: series.map((s, i) => {
|
|
212
224
|
let isSelected = false;
|
|
@@ -236,9 +248,9 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
|
|
|
236
248
|
} }) }, i));
|
|
237
249
|
}) })] })] }) })] }));
|
|
238
250
|
};
|
|
239
|
-
const UtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, utilizationMetricsLoading, }) => {
|
|
251
|
+
const UtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, utilizationMetricsLoading, name, humanReadableName, }) => {
|
|
240
252
|
const { isDarkMode } = useParcaContext();
|
|
241
253
|
const { width, height, margin, heightStyle } = useMetricsGraphDimensions(false, true);
|
|
242
|
-
return (_jsx(AnimatePresence, { children: _jsx(motion.div, { className: "w-full relative", initial: { display: 'none', opacity: 0 }, animate: { display: 'block', opacity: 1 }, transition: { duration: 0.5 }, children: utilizationMetricsLoading === true ? (_jsx(MetricsGraphSkeleton, { heightStyle: heightStyle, isDarkMode: isDarkMode, isMini: true })) : (_jsx(RawUtilizationMetrics, { data: data, addLabelMatcher: addLabelMatcher, setTimeRange: setTimeRange, width: width, height: height, margin: margin })) }, "utilization-metrics-graph-loaded") }));
|
|
254
|
+
return (_jsx(AnimatePresence, { children: _jsx(motion.div, { className: "w-full relative", initial: { display: 'none', opacity: 0 }, animate: { display: 'block', opacity: 1 }, transition: { duration: 0.5 }, children: utilizationMetricsLoading === true ? (_jsx(MetricsGraphSkeleton, { heightStyle: heightStyle, isDarkMode: isDarkMode, isMini: true })) : (_jsx(RawUtilizationMetrics, { data: data, addLabelMatcher: addLabelMatcher, setTimeRange: setTimeRange, width: width, height: height, margin: margin, name: name, humanReadableName: humanReadableName })) }, "utilization-metrics-graph-loaded") }));
|
|
243
255
|
};
|
|
244
256
|
export default UtilizationMetrics;
|
|
@@ -20,7 +20,11 @@ interface MetricsGraphSectionProps {
|
|
|
20
20
|
query: Query;
|
|
21
21
|
setNewQueryExpression: (queryExpression: string) => void;
|
|
22
22
|
setQueryExpression: (updateTs?: boolean) => void;
|
|
23
|
-
utilizationMetrics?:
|
|
23
|
+
utilizationMetrics?: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
humanReadableName: string;
|
|
26
|
+
data: UtilizationMetricsType[];
|
|
27
|
+
}>;
|
|
24
28
|
utilizationMetricsLoading?: boolean;
|
|
25
29
|
}
|
|
26
30
|
export declare function MetricsGraphSection({ showMetricsGraph, setDisplayHideMetricsGraphButton, heightStyle, querySelection, profileSelection, comparing, sumBy, defaultSumByLoading, queryClient, queryExpressionString, setTimeRangeSelection, selectQuery, selectProfile, query, setNewQueryExpression, utilizationMetrics, utilizationMetricsLoading, }: MetricsGraphSectionProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsGraphSection.d.ts","sourceRoot":"","sources":["../../src/ProfileSelector/MetricsGraphSection.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAQ,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAyB,gBAAgB,EAAC,MAAM,IAAI,CAAC;AAG5D,OAAO,EAAC,cAAc,EAAE,KAAK,kBAAkB,IAAI,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAE1F,UAAU,wBAAwB;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gCAAgC,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,kBAAkB,CAAC;IAChC,qBAAqB,EAAE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E,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACtD,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,aAAa,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,KAAK,EAAE,KAAK,CAAC;IACb,qBAAqB,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,kBAAkB,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,KAAK,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,sBAAsB,EAAE,CAAC;KAChC,CAAC,CAAC;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,gBAAgB,EAChB,gCAAgC,EAChC,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,GAC1B,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAyIxC"}
|
|
@@ -77,5 +77,5 @@ export function MetricsGraphSection({ showMetricsGraph, setDisplayHideMetricsGra
|
|
|
77
77
|
};
|
|
78
78
|
return (_jsxs("div", { className: cx('relative', { 'py-4': !showMetricsGraph }), children: [setDisplayHideMetricsGraphButton != null ? (_jsxs("button", { onClick: () => setDisplayHideMetricsGraphButton(!showMetricsGraph), className: cx('hidden px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900 z-10', showMetricsGraph && 'absolute right-0 bottom-3 !flex', !showMetricsGraph && 'relative !flex ml-auto'), children: [showMetricsGraph ? 'Hide' : 'Show', " Metrics Graph"] })) : null, showMetricsGraph && (_jsx(_Fragment, { children: _jsx("div", { style: { height: heightStyle }, children: querySelection.expression !== '' &&
|
|
79
79
|
querySelection.from !== undefined &&
|
|
80
|
-
querySelection.to !== undefined ? (_jsx(_Fragment, { children: utilizationMetrics !== undefined ? (_jsx(UtilizationMetricsGraph, { data:
|
|
80
|
+
querySelection.to !== undefined ? (_jsx(_Fragment, { children: utilizationMetrics !== undefined ? (utilizationMetrics.map(({ name, humanReadableName, data }) => (_jsx(_Fragment, { children: _jsx(UtilizationMetricsGraph, { data: data, addLabelMatcher: addLabelMatcher, setTimeRange: handleTimeRangeChange, utilizationMetricsLoading: utilizationMetricsLoading, name: name, humanReadableName: humanReadableName }, name) })))) : (_jsx(_Fragment, { children: _jsx(ProfileMetricsGraph, { queryClient: queryClient, queryExpression: querySelection.expression, from: querySelection.from, to: querySelection.to, profile: profileSelection, comparing: comparing, sumBy: querySelection.sumBy ?? sumBy ?? [], sumByLoading: defaultSumByLoading, setTimeRange: handleTimeRangeChange, addLabelMatcher: addLabelMatcher, onPointClick: handlePointClick }) })) })) : (profileSelection === null && (_jsx("div", { className: "p-2", children: _jsx(ProfileMetricsEmptyState, { message: "Please select a profile type and click 'Search' to begin." }) }))) }) }))] }));
|
|
81
81
|
}
|
|
@@ -48,7 +48,11 @@ interface ProfileSelectorProps extends ProfileSelectorFeatures {
|
|
|
48
48
|
navigateTo: NavigateFunction;
|
|
49
49
|
setDisplayHideMetricsGraphButton?: Dispatch<SetStateAction<boolean>>;
|
|
50
50
|
suffix?: string;
|
|
51
|
-
utilizationMetrics?:
|
|
51
|
+
utilizationMetrics?: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
humanReadableName: string;
|
|
54
|
+
data: UtilizationMetrics[];
|
|
55
|
+
}>;
|
|
52
56
|
utilizationMetricsLoading?: boolean;
|
|
53
57
|
utilizationLabels?: UtilizationLabels;
|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C,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,KAAK,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,kBAAkB,EAAE,CAAC;KAC5B,CAAC,CAAC;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,WAAY,kBAAkB,KAAG,mBAkB5D,CAAC;AAEF,QAAA,MAAM,eAAe,2UAkBlB,oBAAoB,KAAG,GAAG,CAAC,OAiN7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -140,6 +140,8 @@ const ProfileSelector = ({ queryClient, querySelection, selectProfile, selectQue
|
|
|
140
140
|
queryExpressionString === '{}';
|
|
141
141
|
const queryBrowserRef = useRef(null);
|
|
142
142
|
const sumByRef = useRef(null);
|
|
143
|
-
return (_jsx(UtilizationLabelsProvider, { value: utilizationLabels, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 flex", children: [_jsx(QueryControls, { showProfileTypeSelector: showProfileTypeSelector, showSumBySelector: showSumBySelector, disableExplorativeQuerying: disableExplorativeQuerying, profileTypesData: profileTypesData, profileTypesLoading: profileTypesLoading, selectedProfileName: selectedProfileName, setProfileName: setProfileName, setMatchersString: setMatchersString, setQueryExpression: setQueryExpression, query: query, queryBrowserRef: queryBrowserRef, timeRangeSelection: timeRangeSelection, setTimeRangeSelection: setTimeRangeSelection, searchDisabled: searchDisabled, queryBrowserMode: queryBrowserMode, setQueryBrowserMode: setQueryBrowserMode, advancedModeForQueryBrowser: advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser: setAdvancedModeForQueryBrowser, queryClient: queryClient, sumByRef: sumByRef, labels: labels, sumBySelection: sumBySelection ?? [], setUserSumBySelection: setUserSumBySelection, profileType: profileType, profileTypesError: error, viewComponent: viewComponent }), comparing && (_jsx("div", { children: _jsx(IconButton, { onClick: () => closeProfile(), icon: _jsx(CloseIcon, {}) }) }))] }), _jsx(MetricsGraphSection, { showMetricsGraph: showMetricsGraph, setDisplayHideMetricsGraphButton: setDisplayHideMetricsGraphButton, heightStyle:
|
|
143
|
+
return (_jsx(UtilizationLabelsProvider, { value: { ...utilizationLabels }, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 flex", children: [_jsx(QueryControls, { showProfileTypeSelector: showProfileTypeSelector, showSumBySelector: showSumBySelector, disableExplorativeQuerying: disableExplorativeQuerying, profileTypesData: profileTypesData, profileTypesLoading: profileTypesLoading, selectedProfileName: selectedProfileName, setProfileName: setProfileName, setMatchersString: setMatchersString, setQueryExpression: setQueryExpression, query: query, queryBrowserRef: queryBrowserRef, timeRangeSelection: timeRangeSelection, setTimeRangeSelection: setTimeRangeSelection, searchDisabled: searchDisabled, queryBrowserMode: queryBrowserMode, setQueryBrowserMode: setQueryBrowserMode, advancedModeForQueryBrowser: advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser: setAdvancedModeForQueryBrowser, queryClient: queryClient, sumByRef: sumByRef, labels: labels, sumBySelection: sumBySelection ?? [], setUserSumBySelection: setUserSumBySelection, profileType: profileType, profileTypesError: error, viewComponent: viewComponent }), comparing && (_jsx("div", { children: _jsx(IconButton, { onClick: () => closeProfile(), icon: _jsx(CloseIcon, {}) }) }))] }), _jsx(MetricsGraphSection, { showMetricsGraph: showMetricsGraph, setDisplayHideMetricsGraphButton: setDisplayHideMetricsGraphButton, heightStyle: utilizationMetrics !== undefined && utilizationMetrics?.length > 0
|
|
144
|
+
? 'auto'
|
|
145
|
+
: heightStyle, querySelection: querySelection, profileSelection: profileSelection, comparing: comparing, sumBy: querySelection.sumBy ?? defaultSumBy ?? [], defaultSumByLoading: defaultSumByLoading, queryClient: queryClient, queryExpressionString: queryExpressionString, setTimeRangeSelection: setTimeRangeSelection, selectQuery: selectQuery, selectProfile: selectProfile, query: query, setQueryExpression: setQueryExpression, setNewQueryExpression: setNewQueryExpression, utilizationMetrics: utilizationMetrics, utilizationMetricsLoading: utilizationMetricsLoading })] }) }));
|
|
144
146
|
};
|
|
145
147
|
export default ProfileSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/Select.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/Select.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAQzD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8Q7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import { useEffect, useRef, useState } from 'react';
|
|
15
15
|
import { Icon } from '@iconify/react';
|
|
16
16
|
import cx from 'classnames';
|
|
17
|
+
import levenshtein from 'fast-levenshtein';
|
|
17
18
|
import { Button, useParcaContext } from '@parca/components';
|
|
18
19
|
const CustomSelect = ({ items, selectedKey, onSelection, placeholder = 'Select an item', width, className = '', loading, primary = false, disabled = false, icon, id, optionsClassname = '', searchable = false, onButtonClick, editable = false, }) => {
|
|
19
20
|
const { loader } = useParcaContext();
|
|
@@ -25,10 +26,17 @@ const CustomSelect = ({ items, selectedKey, onSelection, placeholder = 'Select a
|
|
|
25
26
|
const searchInputRef = useRef(null);
|
|
26
27
|
const optionRefs = useRef([]);
|
|
27
28
|
const filteredItems = searchable
|
|
28
|
-
? items
|
|
29
|
+
? items
|
|
30
|
+
.filter(item => item.element.active.props.children
|
|
29
31
|
.toString()
|
|
30
32
|
.toLowerCase()
|
|
31
33
|
.includes(searchTerm.toLowerCase()))
|
|
34
|
+
.sort((a, b) => {
|
|
35
|
+
if (searchTerm === '') {
|
|
36
|
+
return a.key.localeCompare(b.key);
|
|
37
|
+
}
|
|
38
|
+
return levenshtein.get(a.key, searchTerm) - levenshtein.get(b.key, searchTerm);
|
|
39
|
+
})
|
|
32
40
|
: items;
|
|
33
41
|
const selection = editable ? selectedKey : items.find(v => v.key === selectedKey);
|
|
34
42
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.487",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@headlessui/react": "^1.7.19",
|
|
7
7
|
"@iconify/react": "^4.0.0",
|
|
8
8
|
"@parca/client": "0.16.127",
|
|
9
|
-
"@parca/components": "0.16.
|
|
9
|
+
"@parca/components": "0.16.324",
|
|
10
10
|
"@parca/dynamicsize": "0.16.65",
|
|
11
|
-
"@parca/hooks": "0.0.
|
|
11
|
+
"@parca/hooks": "0.0.81",
|
|
12
12
|
"@parca/icons": "0.16.71",
|
|
13
13
|
"@parca/parser": "0.16.78",
|
|
14
|
-
"@parca/store": "0.16.
|
|
15
|
-
"@parca/utilities": "0.0.
|
|
14
|
+
"@parca/store": "0.16.167",
|
|
15
|
+
"@parca/utilities": "0.0.93",
|
|
16
16
|
"@popperjs/core": "^2.11.8",
|
|
17
17
|
"@protobuf-ts/runtime-rpc": "^2.5.0",
|
|
18
18
|
"@storybook/preview-api": "^8.4.3",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@types/d3": "^7.4.3",
|
|
23
23
|
"@types/d3-scale": "^4.0.8",
|
|
24
24
|
"@types/d3-selection": "^3.0.10",
|
|
25
|
+
"@types/fast-levenshtein": "^0.0.4",
|
|
25
26
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
26
27
|
"apache-arrow": "^12.0.1",
|
|
27
28
|
"classnames": "^2.3.1",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"d3-selection": "3.0.0",
|
|
34
35
|
"d3-shape": "^3.2.0",
|
|
35
36
|
"fast-deep-equal": "^3.1.3",
|
|
37
|
+
"fast-levenshtein": "^3.0.0",
|
|
36
38
|
"framer-motion": "6.5.1",
|
|
37
39
|
"graphviz-wasm": "3.0.2",
|
|
38
40
|
"lodash.throttle": "^4.1.1",
|
|
@@ -75,5 +77,5 @@
|
|
|
75
77
|
"access": "public",
|
|
76
78
|
"registry": "https://registry.npmjs.org/"
|
|
77
79
|
},
|
|
78
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "a4d40a370c834f8aa8a9880bb00042ff8c68e64f"
|
|
79
81
|
}
|
|
@@ -36,6 +36,8 @@ interface CommonProps {
|
|
|
36
36
|
labels: {key: string; value: string} | Array<{key: string; value: string}>
|
|
37
37
|
) => void;
|
|
38
38
|
setTimeRange: (range: DateTimeRange) => void;
|
|
39
|
+
name: string;
|
|
40
|
+
humanReadableName: string;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
type RawUtilizationMetricsProps = CommonProps & {
|
|
@@ -83,6 +85,19 @@ function transformToSeries(data: MetricSeries[]): Series[] {
|
|
|
83
85
|
}));
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
const getYAxisUnit = (name: string): string => {
|
|
89
|
+
switch (name) {
|
|
90
|
+
case 'gpu_utilization_percent':
|
|
91
|
+
return 'percent';
|
|
92
|
+
case 'gpu_memory_utilization_percent':
|
|
93
|
+
return 'percent';
|
|
94
|
+
case 'gpu_power_watt':
|
|
95
|
+
return 'watts';
|
|
96
|
+
default:
|
|
97
|
+
return 'percent';
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
86
101
|
const RawUtilizationMetrics = ({
|
|
87
102
|
data,
|
|
88
103
|
addLabelMatcher,
|
|
@@ -90,6 +105,8 @@ const RawUtilizationMetrics = ({
|
|
|
90
105
|
width,
|
|
91
106
|
height,
|
|
92
107
|
margin,
|
|
108
|
+
name,
|
|
109
|
+
humanReadableName,
|
|
93
110
|
}: RawUtilizationMetricsProps): JSX.Element => {
|
|
94
111
|
const {timezone} = useParcaContext();
|
|
95
112
|
const graph = useRef(null);
|
|
@@ -310,7 +327,7 @@ const RawUtilizationMetrics = ({
|
|
|
310
327
|
y={pos[1] + margin}
|
|
311
328
|
highlighted={highlighted}
|
|
312
329
|
contextElement={graph.current}
|
|
313
|
-
sampleUnit=
|
|
330
|
+
sampleUnit={getYAxisUnit(name)}
|
|
314
331
|
delta={false}
|
|
315
332
|
utilizationMetrics={true}
|
|
316
333
|
/>
|
|
@@ -367,7 +384,7 @@ const RawUtilizationMetrics = ({
|
|
|
367
384
|
>
|
|
368
385
|
<line className="stroke-gray-300 dark:stroke-gray-500" x2={-6} />
|
|
369
386
|
<text fill="currentColor" x={-9} dy={'0.32em'}>
|
|
370
|
-
{valueFormatter(d,
|
|
387
|
+
{valueFormatter(d, getYAxisUnit(name), decimals)}
|
|
371
388
|
</text>
|
|
372
389
|
</g>
|
|
373
390
|
<g key={`grid-${i}`}>
|
|
@@ -403,7 +420,7 @@ const RawUtilizationMetrics = ({
|
|
|
403
420
|
className="text-sm capitalize"
|
|
404
421
|
textAnchor="middle"
|
|
405
422
|
>
|
|
406
|
-
|
|
423
|
+
{humanReadableName}
|
|
407
424
|
</text>
|
|
408
425
|
</g>
|
|
409
426
|
</g>
|
|
@@ -511,6 +528,8 @@ const UtilizationMetrics = ({
|
|
|
511
528
|
addLabelMatcher,
|
|
512
529
|
setTimeRange,
|
|
513
530
|
utilizationMetricsLoading,
|
|
531
|
+
name,
|
|
532
|
+
humanReadableName,
|
|
514
533
|
}: Props): JSX.Element => {
|
|
515
534
|
const {isDarkMode} = useParcaContext();
|
|
516
535
|
const {width, height, margin, heightStyle} = useMetricsGraphDimensions(false, true);
|
|
@@ -534,6 +553,8 @@ const UtilizationMetrics = ({
|
|
|
534
553
|
width={width}
|
|
535
554
|
height={height}
|
|
536
555
|
margin={margin}
|
|
556
|
+
name={name}
|
|
557
|
+
humanReadableName={humanReadableName}
|
|
537
558
|
/>
|
|
538
559
|
)}
|
|
539
560
|
</motion.div>
|
|
@@ -39,7 +39,11 @@ interface MetricsGraphSectionProps {
|
|
|
39
39
|
query: Query;
|
|
40
40
|
setNewQueryExpression: (queryExpression: string) => void;
|
|
41
41
|
setQueryExpression: (updateTs?: boolean) => void;
|
|
42
|
-
utilizationMetrics?:
|
|
42
|
+
utilizationMetrics?: Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
humanReadableName: string;
|
|
45
|
+
data: UtilizationMetricsType[];
|
|
46
|
+
}>;
|
|
43
47
|
utilizationMetricsLoading?: boolean;
|
|
44
48
|
}
|
|
45
49
|
|
|
@@ -155,12 +159,19 @@ export function MetricsGraphSection({
|
|
|
155
159
|
querySelection.to !== undefined ? (
|
|
156
160
|
<>
|
|
157
161
|
{utilizationMetrics !== undefined ? (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
utilizationMetrics.map(({name, humanReadableName, data}) => (
|
|
163
|
+
<>
|
|
164
|
+
<UtilizationMetricsGraph
|
|
165
|
+
key={name}
|
|
166
|
+
data={data}
|
|
167
|
+
addLabelMatcher={addLabelMatcher}
|
|
168
|
+
setTimeRange={handleTimeRangeChange}
|
|
169
|
+
utilizationMetricsLoading={utilizationMetricsLoading}
|
|
170
|
+
name={name}
|
|
171
|
+
humanReadableName={humanReadableName}
|
|
172
|
+
/>
|
|
173
|
+
</>
|
|
174
|
+
))
|
|
164
175
|
) : (
|
|
165
176
|
<>
|
|
166
177
|
<ProfileMetricsGraph
|
|
@@ -85,7 +85,11 @@ interface ProfileSelectorProps extends ProfileSelectorFeatures {
|
|
|
85
85
|
navigateTo: NavigateFunction;
|
|
86
86
|
setDisplayHideMetricsGraphButton?: Dispatch<SetStateAction<boolean>>;
|
|
87
87
|
suffix?: string;
|
|
88
|
-
utilizationMetrics?:
|
|
88
|
+
utilizationMetrics?: Array<{
|
|
89
|
+
name: string;
|
|
90
|
+
humanReadableName: string;
|
|
91
|
+
data: UtilizationMetrics[];
|
|
92
|
+
}>;
|
|
89
93
|
utilizationMetricsLoading?: boolean;
|
|
90
94
|
utilizationLabels?: UtilizationLabels;
|
|
91
95
|
}
|
|
@@ -279,7 +283,7 @@ const ProfileSelector = ({
|
|
|
279
283
|
const sumByRef = useRef(null);
|
|
280
284
|
|
|
281
285
|
return (
|
|
282
|
-
<UtilizationLabelsProvider value={utilizationLabels}>
|
|
286
|
+
<UtilizationLabelsProvider value={{...utilizationLabels}}>
|
|
283
287
|
<>
|
|
284
288
|
<div className="mb-2 flex">
|
|
285
289
|
<QueryControls
|
|
@@ -319,7 +323,11 @@ const ProfileSelector = ({
|
|
|
319
323
|
<MetricsGraphSection
|
|
320
324
|
showMetricsGraph={showMetricsGraph}
|
|
321
325
|
setDisplayHideMetricsGraphButton={setDisplayHideMetricsGraphButton}
|
|
322
|
-
heightStyle={
|
|
326
|
+
heightStyle={
|
|
327
|
+
utilizationMetrics !== undefined && utilizationMetrics?.length > 0
|
|
328
|
+
? 'auto'
|
|
329
|
+
: heightStyle
|
|
330
|
+
}
|
|
323
331
|
querySelection={querySelection}
|
|
324
332
|
profileSelection={profileSelection}
|
|
325
333
|
comparing={comparing}
|
|
@@ -15,6 +15,7 @@ import React, {useEffect, useRef, useState} from 'react';
|
|
|
15
15
|
|
|
16
16
|
import {Icon} from '@iconify/react';
|
|
17
17
|
import cx from 'classnames';
|
|
18
|
+
import levenshtein from 'fast-levenshtein';
|
|
18
19
|
|
|
19
20
|
import {Button, useParcaContext} from '@parca/components';
|
|
20
21
|
|
|
@@ -74,12 +75,19 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
|
|
|
74
75
|
const optionRefs = useRef<Array<HTMLElement | null>>([]);
|
|
75
76
|
|
|
76
77
|
const filteredItems = searchable
|
|
77
|
-
? items
|
|
78
|
-
item
|
|
79
|
-
.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
? items
|
|
79
|
+
.filter(item =>
|
|
80
|
+
item.element.active.props.children
|
|
81
|
+
.toString()
|
|
82
|
+
.toLowerCase()
|
|
83
|
+
.includes(searchTerm.toLowerCase())
|
|
84
|
+
)
|
|
85
|
+
.sort((a, b) => {
|
|
86
|
+
if (searchTerm === '') {
|
|
87
|
+
return a.key.localeCompare(b.key);
|
|
88
|
+
}
|
|
89
|
+
return levenshtein.get(a.key, searchTerm) - levenshtein.get(b.key, searchTerm);
|
|
90
|
+
})
|
|
83
91
|
: items;
|
|
84
92
|
|
|
85
93
|
const selection = editable ? selectedKey : items.find(v => v.key === selectedKey);
|