@parca/profile 0.16.237 → 0.16.239
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/Callgraph/index.js +2 -2
- package/dist/MetricsGraph/index.js +4 -4
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +1 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +1 -1
- package/dist/ProfileIcicleGraph/index.js +2 -2
- package/dist/ProfileView/index.js +3 -1
- package/dist/SourceView/Highlighter.d.ts +2 -2
- package/dist/SourceView/Highlighter.js +9 -3
- package/dist/SourceView/index.js +1 -1
- package/dist/SourceView/lang-detector/ext-to-lang.json +800 -0
- package/dist/SourceView/lang-detector/index.d.ts +1 -0
- package/dist/SourceView/lang-detector/index.js +29 -0
- package/dist/Table/index.js +3 -3
- package/dist/TopTable/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/Callgraph/index.tsx +2 -1
- package/src/MetricsGraph/index.tsx +5 -5
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +11 -13
- package/src/ProfileExplorer/ProfileExplorerSingle.tsx +8 -10
- package/src/ProfileIcicleGraph/index.tsx +4 -2
- package/src/ProfileView/index.tsx +4 -2
- package/src/SourceView/Highlighter.tsx +16 -4
- package/src/SourceView/index.tsx +1 -0
- package/src/SourceView/lang-detector/ext-to-lang.json +800 -0
- package/src/SourceView/lang-detector/index.ts +33 -0
- package/src/Table/index.tsx +3 -3
- package/src/TopTable/index.tsx +2 -1
- package/typings.d.ts +1 -0
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.239](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.238...@parca/profile@0.16.239) (2023-08-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.238](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.237...@parca/profile@0.16.238) (2023-08-30)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.16.237](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.236...@parca/profile@0.16.237) (2023-08-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
package/dist/Callgraph/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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.
|
|
@@ -93,7 +93,7 @@ const Callgraph = ({ data, svgString, sampleUnit, width }) => {
|
|
|
93
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
94
|
}, [svgWrapper.current, svgWrapperLoaded]);
|
|
95
95
|
if (data.nodes.length < 1)
|
|
96
|
-
return _jsx(
|
|
96
|
+
return _jsx("div", { className: "mx-auto text-center", children: "Profile has no samples" });
|
|
97
97
|
const resetView = () => setView(originalView);
|
|
98
98
|
const isResetViewButtonEnabled = view.scale !== originalView.scale ||
|
|
99
99
|
view.translation.x !== originalView.translation.x ||
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { useRef, useState } from 'react';
|
|
14
|
+
import { Fragment, useRef, useState } from 'react';
|
|
15
15
|
import * as d3 from 'd3';
|
|
16
16
|
import { pointer } from 'd3-selection';
|
|
17
17
|
import throttle from 'lodash.throttle';
|
|
@@ -230,11 +230,11 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, onLabe
|
|
|
230
230
|
const selected = findSelectedProfile();
|
|
231
231
|
return (_jsxs(_Fragment, { children: [highlighted != null && hovering && !dragging && pos[0] !== 0 && pos[1] !== 0 && (_jsx("div", { onMouseMove: onMouseMove, onMouseEnter: () => setHovering(true), onMouseLeave: () => setHovering(false), children: _jsx(MetricsTooltip, { x: pos[0] + margin, y: pos[1] + margin, highlighted: highlighted, onLabelClick: onLabelClick, contextElement: graph.current, sampleUnit: sampleUnit, delta: profile !== null ? profile?.query.profType.delta : false }) })), _jsx("div", { ref: graph, onMouseEnter: function () {
|
|
232
232
|
setHovering(true);
|
|
233
|
-
}, onMouseLeave: () => setHovering(false), 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}, ${margin})`, children: [_jsxs("g", { className: "y axis", textAnchor: "end", fontSize: "10", fill: "none", children: [yScale.ticks(5).map((d, i) => (_jsxs(
|
|
233
|
+
}, onMouseLeave: () => setHovering(false), 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}, ${margin})`, children: [_jsxs("g", { className: "y axis", textAnchor: "end", fontSize: "10", fill: "none", children: [yScale.ticks(5).map((d, i) => (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
|
|
234
234
|
/* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
|
|
235
|
-
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, sampleUnit, 1) })] }, `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}`)] }))), _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 })] }), _jsxs("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: [xScale.ticks(5).map((d, i) => (_jsxs(
|
|
235
|
+
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, sampleUnit, 1) })] }, `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()}`))), _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 })] }), _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",
|
|
236
236
|
/* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
|
|
237
|
-
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)) })] }, `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}`)] }))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(from), x2: xScale(to), y1: 0, y2: 0 })] }), _jsx("g", { className: "lines fill-transparent", children: series.map((s, i) => (_jsx("g", { className: "line", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
|
|
237
|
+
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)) })] }, `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: xScale(from), x2: xScale(to), y1: 0, y2: 0 })] }), _jsx("g", { className: "lines fill-transparent", children: series.map((s, i) => (_jsx("g", { className: "line", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
|
|
238
238
|
? lineStrokeHover
|
|
239
239
|
: lineStroke, xScale: xScale, yScale: yScale }) }, i))) }), hovering && highlighted != null && (_jsx("g", { className: "circle-group", ref: metricPointRef, style: { fill: color(highlighted.seriesIndex.toString()) }, children: _jsx(MetricsCircle, { cx: highlighted.x, cy: highlighted.y }) })), selected != null && (_jsx("g", { className: "circle-group", style: selected?.seriesIndex != null
|
|
240
240
|
? { fill: color(selected.seriesIndex.toString()) }
|
|
@@ -10,6 +10,6 @@ const ProfileExplorerCompare = ({ queryClient, queryA, queryB, profileA, profile
|
|
|
10
10
|
const closeProfileB = () => {
|
|
11
11
|
closeProfile('B');
|
|
12
12
|
};
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex justify-between gap-2", children: [_jsx(Card, { className: "p-2", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryA, profileSelection: profileA, selectProfile: selectProfileA, selectQuery: selectQueryA, closeProfile: closeProfileA, enforcedProfileName: '', comparing: true, onCompareProfile: () => { } }) }), _jsx(Card, { className: "p-2", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryB, profileSelection: profileB, selectProfile: selectProfileB, selectQuery: selectQueryB, closeProfile: closeProfileB, enforcedProfileName: Query.parse(queryA.expression).profileName(), comparing: true, onCompareProfile: () => { } }) })] }), _jsx("div", { className: "grid grid-cols-1", children: profileA != null && profileB != null ? (_jsx(
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex justify-between gap-2", children: [_jsx(Card, { className: "mt-2 p-2", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryA, profileSelection: profileA, selectProfile: selectProfileA, selectQuery: selectQueryA, closeProfile: closeProfileA, enforcedProfileName: '', comparing: true, onCompareProfile: () => { } }) }), _jsx(Card, { className: "mt-2 p-2", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryB, profileSelection: profileB, selectProfile: selectProfileB, selectQuery: selectQueryB, closeProfile: closeProfileB, enforcedProfileName: Query.parse(queryA.expression).profileName(), comparing: true, onCompareProfile: () => { } }) })] }), _jsx("div", { className: "grid grid-cols-1", children: profileA != null && profileB != null ? (_jsx(Card, { className: "mt-2 px-6 py-4", children: _jsx(ProfileViewWithData, { navigateTo: navigateTo, queryClient: queryClient, profileSource: new ProfileDiffSource(profileA.ProfileSource(), profileB.ProfileSource()) }) })) : (_jsx("div", { children: _jsx("div", { className: "my-20 text-center", children: _jsx("p", { children: "Select a profile on both sides." }) }) })) })] }));
|
|
14
14
|
};
|
|
15
15
|
export default ProfileExplorerCompare;
|
|
@@ -3,6 +3,6 @@ import { Card } from '@parca/components';
|
|
|
3
3
|
import { ProfileViewWithData } from '..';
|
|
4
4
|
import ProfileSelector from '../ProfileSelector';
|
|
5
5
|
const ProfileExplorerSingle = ({ queryClient, query, selectQuery, selectProfile, profile, compareProfile, navigateTo, }) => {
|
|
6
|
-
return (_jsxs(_Fragment, { children: [_jsx(Card, { className: "px-6 py-4", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: query, selectQuery: selectQuery, selectProfile: selectProfile, closeProfile: () => { }, profileSelection: profile, comparing: false, onCompareProfile: compareProfile, enforcedProfileName: '' }) }), profile != null ? (_jsx(
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx(Card, { className: "mt-2 px-6 py-4", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: query, selectQuery: selectQuery, selectProfile: selectProfile, closeProfile: () => { }, profileSelection: profile, comparing: false, onCompareProfile: compareProfile, enforcedProfileName: '' }) }), profile != null ? (_jsx(Card, { className: "mt-2 px-6 py-4", children: _jsx(ProfileViewWithData, { queryClient: queryClient, profileSource: profile.ProfileSource(), navigateTo: navigateTo }) })) : (_jsx(_Fragment, {}))] }));
|
|
7
7
|
};
|
|
8
8
|
export default ProfileExplorerSingle;
|
|
@@ -87,9 +87,9 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ graph, table, to
|
|
|
87
87
|
return _jsxs("div", { className: "flex justify-center p-10", children: ["An error occurred: ", error.message] });
|
|
88
88
|
}
|
|
89
89
|
if (graph === undefined && table === undefined)
|
|
90
|
-
return _jsx("div", { children: "no data..." });
|
|
90
|
+
return _jsx("div", { className: "mx-auto text-center", children: "no data..." });
|
|
91
91
|
if (total === 0n && !loading)
|
|
92
|
-
return _jsx(
|
|
92
|
+
return _jsx("div", { className: "mx-auto text-center", children: "Profile has no samples" });
|
|
93
93
|
if (isTrimmed) {
|
|
94
94
|
console.info(`Trimmed ${trimmedFormatted} (${trimmedPercentage}%) too small values.`);
|
|
95
95
|
}
|
|
@@ -173,7 +173,9 @@ export const ProfileView = ({ total, filtered, flamegraphData, topTableData, cal
|
|
|
173
173
|
e.preventDefault();
|
|
174
174
|
onDownloadPProf();
|
|
175
175
|
}, disabled: pprofDownloading, children: [pprofDownloading != null && pprofDownloading ? 'Downloading...' : 'Download pprof', _jsx(Icon, { icon: "material-symbols:download", width: 20 })] }), _jsx(ViewSelector, { defaultValue: "", navigateTo: navigateTo, position: -1, placeholderText: "Add panel", icon: _jsx(Icon, { icon: "material-symbols:add", width: 20 }), addView: true, disabled: isMultiPanelView || dashboardItems.length < 1 })] })] }), _jsx("div", { className: "w-full", ref: ref, children: isLoaderVisible ? (_jsx(_Fragment, { children: loader })) : (_jsx(DragDropContext, { onDragEnd: onDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "horizontal", children: provided => (_jsx("div", { ref: provided.innerRef, className: cx('grid w-full gap-2', isMultiPanelView ? 'grid-cols-2' : 'grid-cols-1'), ...provided.droppableProps, children: dashboardItems.map((dashboardItem, index) => {
|
|
176
|
-
return (_jsx(Draggable, { draggableId: dashboardItem, index: index, isDragDisabled: !isMultiPanelView, children: (provided, snapshot) => (_createElement("div", { ref: provided.innerRef, ...provided.draggableProps, key: dashboardItem, className: cx('w-full rounded p-2 shadow dark:border-gray-
|
|
176
|
+
return (_jsx(Draggable, { draggableId: dashboardItem, index: index, isDragDisabled: !isMultiPanelView, children: (provided, snapshot) => (_createElement("div", { ref: provided.innerRef, ...provided.draggableProps, key: dashboardItem, className: cx('min-h-[200px] w-full rounded p-2 shadow dark:border dark:border-gray-700 dark:bg-gray-700', snapshot.isDragging
|
|
177
|
+
? 'bg-gray-200 dark:bg-gray-500'
|
|
178
|
+
: 'bg-white dark:bg-gray-700') },
|
|
177
179
|
_jsx(VisualizationPanel, { handleClosePanel: handleClosePanel, isMultiPanelView: isMultiPanelView, dashboardItem: dashboardItem, getDashboardItemByType: getDashboardItemByType, dragHandleProps: provided.dragHandleProps, navigateTo: navigateTo, index: index }))) }, dashboardItem));
|
|
178
180
|
}) })) }) })) })] }) }));
|
|
179
181
|
};
|
|
@@ -7,10 +7,10 @@ interface RendererProps {
|
|
|
7
7
|
}
|
|
8
8
|
type Renderer = ({ rows, stylesheet, useInlineStyles }: RendererProps) => JSX.Element;
|
|
9
9
|
interface HighlighterProps {
|
|
10
|
+
file: string;
|
|
10
11
|
content: string;
|
|
11
|
-
language?: string;
|
|
12
12
|
renderer?: Renderer;
|
|
13
13
|
}
|
|
14
14
|
export declare const profileAwareRenderer: (cumulative: Vector | null, flat: Vector | null, total: bigint, filtered: bigint) => Renderer;
|
|
15
|
-
export declare const Highlighter: ({
|
|
15
|
+
export declare const Highlighter: ({ file, content, renderer }: HighlighterProps) => JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { useId } from 'react';
|
|
14
|
+
import { useId, useMemo } from 'react';
|
|
15
15
|
import cx from 'classnames';
|
|
16
16
|
import { scaleLinear } from 'd3-scale';
|
|
17
17
|
import SyntaxHighlighter, { createElement } from 'react-syntax-highlighter';
|
|
@@ -21,6 +21,7 @@ import { useURLState } from '@parca/components';
|
|
|
21
21
|
import { selectDarkMode, useAppSelector } from '@parca/store';
|
|
22
22
|
import { useProfileViewContext } from '../ProfileView/ProfileViewContext';
|
|
23
23
|
import { LineNo } from './LineNo';
|
|
24
|
+
import { langaugeFromFile } from './lang-detector';
|
|
24
25
|
// cannot make this a function on the number as we need the classes to be static for tailwind
|
|
25
26
|
const charsToWidthMap = {
|
|
26
27
|
1: 'w-3',
|
|
@@ -74,7 +75,12 @@ export const profileAwareRenderer = (cumulative, flat, total, filtered) => {
|
|
|
74
75
|
}) }));
|
|
75
76
|
};
|
|
76
77
|
};
|
|
77
|
-
export const Highlighter = ({
|
|
78
|
+
export const Highlighter = ({ file, content, renderer }) => {
|
|
78
79
|
const isDarkMode = useAppSelector(selectDarkMode);
|
|
79
|
-
|
|
80
|
+
const language = useMemo(() => langaugeFromFile(file), [file]);
|
|
81
|
+
return (_jsxs("div", { className: "relative", children: [_jsxs("div", { className: "flex gap-2 text-xs", children: [_jsx("div", { className: cx('text-right', charsToWidth(content
|
|
82
|
+
.split(
|
|
83
|
+
// prettier-ignore
|
|
84
|
+
'\n')
|
|
85
|
+
.length.toString().length)), children: "Line" }), _jsxs("div", { className: "flex gap-3", children: [_jsx("div", { children: "Cumulative" }), _jsx("div", { children: "Flat" }), _jsx("div", { children: "Source" })] })] }), _jsx("div", { className: "text-xs", children: _jsx(SyntaxHighlighter, { language: language, style: isDarkMode ? atomOneDark : atomOneLight, showLineNumbers: true, renderer: renderer, customStyle: { padding: 0, height: '80vh' }, children: content }) })] }));
|
|
80
86
|
};
|
package/dist/SourceView/index.js
CHANGED
|
@@ -32,6 +32,6 @@ export const SourceView = React.memo(function SourceView({ data, loading, total,
|
|
|
32
32
|
const table = tableFromIPC(data.record);
|
|
33
33
|
const cumulative = table.getChild('cumulative');
|
|
34
34
|
const flat = table.getChild('flat');
|
|
35
|
-
return (_jsx(Highlighter, { content: data.source, renderer: profileAwareRenderer(cumulative, flat, total, filtered) }));
|
|
35
|
+
return (_jsx(Highlighter, { file: sourceFileName, content: data.source, renderer: profileAwareRenderer(cumulative, flat, total, filtered) }));
|
|
36
36
|
});
|
|
37
37
|
export default SourceView;
|