@parca/profile 0.16.327 → 0.16.329
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,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.329](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.328...@parca/profile@0.16.329) (2024-01-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.328](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.327...@parca/profile@0.16.328) (2024-01-02)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## 0.16.327 (2023-12-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -147,7 +147,7 @@ const MatchersInput = ({ queryClient, setMatchersString, runQuery, currentQuery,
|
|
|
147
147
|
setFocusedInput(false);
|
|
148
148
|
};
|
|
149
149
|
const profileSelected = currentQuery.profileName() === '';
|
|
150
|
-
return (_jsxs("div", { className: "w-full min-w-[300px] flex-1 font-mono", children: [_jsx(TextareaAutosize, { ref: inputRef, className: cx('block h-[38px] w-full flex-1 rounded-md border bg-white px-2 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900', profileSelected && 'cursor-not-allowed'), placeholder: profileSelected
|
|
150
|
+
return (_jsxs("div", { className: "w-full min-w-[300px] flex-1 font-mono relative", children: [_jsx(TextareaAutosize, { ref: inputRef, className: cx('block h-[38px] w-full flex-1 rounded-md border bg-white px-2 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900', profileSelected && 'cursor-not-allowed'), placeholder: profileSelected
|
|
151
151
|
? 'Select a profile first to enter a filter...'
|
|
152
152
|
: 'filter profiles... eg. node="test"', onChange: onChange, value: value, onBlur: unfocus, onFocus: focus, disabled: profileSelected, title: profileSelected
|
|
153
153
|
? 'Select a profile first to enter a filter...'
|
|
@@ -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 { Fragment, useCallback, useRef, useState } from 'react';
|
|
14
|
+
import { Fragment, useCallback, useMemo, 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';
|
|
@@ -92,11 +92,12 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
|
|
|
92
92
|
.nice();
|
|
93
93
|
const color = d3.scaleOrdinal(d3.schemeCategory10);
|
|
94
94
|
const l = d3.line(d => xScale(d[0]), d => yScale(d[1]));
|
|
95
|
-
const
|
|
95
|
+
const highlighted = useMemo(() => {
|
|
96
|
+
// Return the closest point as the highlighted point
|
|
96
97
|
const closestPointPerSeries = series.map(function (s) {
|
|
97
98
|
const distances = s.values.map(d => {
|
|
98
|
-
const x = xScale(d[0]);
|
|
99
|
-
const y = yScale(d[1]);
|
|
99
|
+
const x = xScale(d[0]) + margin / 2;
|
|
100
|
+
const y = yScale(d[1]) - margin / 3;
|
|
100
101
|
return Math.sqrt(Math.pow(pos[0] - x, 2) + Math.pow(pos[1] - y, 2));
|
|
101
102
|
});
|
|
102
103
|
const pointIndex = d3.minIndex(distances);
|
|
@@ -119,8 +120,7 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
|
|
|
119
120
|
x: xScale(point[0]),
|
|
120
121
|
y: yScale(point[1]),
|
|
121
122
|
};
|
|
122
|
-
};
|
|
123
|
-
const highlighted = getClosest();
|
|
123
|
+
}, [pos, series, xScale, yScale, margin]);
|
|
124
124
|
const onMouseDown = (e) => {
|
|
125
125
|
// only left mouse button
|
|
126
126
|
if (e.button !== 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.329",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.16.100",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"access": "public",
|
|
51
51
|
"registry": "https://registry.npmjs.org/"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "609093d9e68e941b4daf85dc99ae622c320b0e46"
|
|
54
54
|
}
|
|
@@ -205,7 +205,7 @@ const MatchersInput = ({
|
|
|
205
205
|
const profileSelected = currentQuery.profileName() === '';
|
|
206
206
|
|
|
207
207
|
return (
|
|
208
|
-
<div className="w-full min-w-[300px] flex-1 font-mono">
|
|
208
|
+
<div className="w-full min-w-[300px] flex-1 font-mono relative">
|
|
209
209
|
<TextareaAutosize
|
|
210
210
|
ref={inputRef}
|
|
211
211
|
className={cx(
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
-
import React, {Fragment, useCallback, useRef, useState} from 'react';
|
|
14
|
+
import React, {Fragment, useCallback, useMemo, useRef, useState} from 'react';
|
|
15
15
|
|
|
16
16
|
import * as d3 from 'd3';
|
|
17
17
|
import {pointer} from 'd3-selection';
|
|
@@ -201,11 +201,13 @@ export const RawMetricsGraph = ({
|
|
|
201
201
|
d => yScale(d[1])
|
|
202
202
|
);
|
|
203
203
|
|
|
204
|
-
const
|
|
204
|
+
const highlighted = useMemo(() => {
|
|
205
|
+
// Return the closest point as the highlighted point
|
|
206
|
+
|
|
205
207
|
const closestPointPerSeries = series.map(function (s) {
|
|
206
208
|
const distances = s.values.map(d => {
|
|
207
|
-
const x = xScale(d[0]);
|
|
208
|
-
const y = yScale(d[1]);
|
|
209
|
+
const x = xScale(d[0]) + margin / 2;
|
|
210
|
+
const y = yScale(d[1]) - margin / 3;
|
|
209
211
|
|
|
210
212
|
return Math.sqrt(Math.pow(pos[0] - x, 2) + Math.pow(pos[1] - y, 2));
|
|
211
213
|
});
|
|
@@ -221,7 +223,6 @@ export const RawMetricsGraph = ({
|
|
|
221
223
|
const closestSeriesIndex = d3.minIndex(closestPointPerSeries, s => s.distance);
|
|
222
224
|
const pointIndex = closestPointPerSeries[closestSeriesIndex].pointIndex;
|
|
223
225
|
const point = series[closestSeriesIndex].values[pointIndex];
|
|
224
|
-
|
|
225
226
|
return {
|
|
226
227
|
seriesIndex: closestSeriesIndex,
|
|
227
228
|
labels: series[closestSeriesIndex].metric,
|
|
@@ -232,9 +233,7 @@ export const RawMetricsGraph = ({
|
|
|
232
233
|
x: xScale(point[0]),
|
|
233
234
|
y: yScale(point[1]),
|
|
234
235
|
};
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const highlighted = getClosest();
|
|
236
|
+
}, [pos, series, xScale, yScale, margin]);
|
|
238
237
|
|
|
239
238
|
const onMouseDown = (e: React.MouseEvent<SVGSVGElement | HTMLDivElement, MouseEvent>): void => {
|
|
240
239
|
// only left mouse button
|