@parca/profile 0.16.328 → 0.16.330

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.330](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.329...@parca/profile@0.16.330) (2024-01-03)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.329](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.328...@parca/profile@0.16.329) (2024-01-03)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.328](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.327...@parca/profile@0.16.328) (2024-01-02)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -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 getClosest = () => {
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) {
@@ -16,8 +16,7 @@ export interface ProfileSelection {
16
16
  ProfileSource: () => ProfileSource;
17
17
  Type: () => string;
18
18
  }
19
- export declare const timeFormat = "MMM d, 'at' h:mm:s a '(UTC)'";
20
- export declare const timeFormatShort = "MMM d, h:mma";
19
+ export declare const timeFormat = "MMM d, 'at' HH:mm:ss '(UTC)'";
21
20
  export declare function ParamsString(params: {
22
21
  [key: string]: string;
23
22
  }): string;
@@ -14,8 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  import { ProfileDiffSelection_Mode, QueryRequest_Mode, QueryRequest_ReportType, Timestamp, } from '@parca/client';
15
15
  import { ProfileType, Query } from '@parca/parser';
16
16
  import { formatDate } from '@parca/utilities';
17
- export const timeFormat = "MMM d, 'at' h:mm:s a '(UTC)'";
18
- export const timeFormatShort = 'MMM d, h:mma';
17
+ export const timeFormat = "MMM d, 'at' HH:mm:ss '(UTC)'";
19
18
  export function ParamsString(params) {
20
19
  return Object.keys(params)
21
20
  .map(function (key) {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.328",
3
+ "version": "0.16.330",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.100",
7
- "@parca/components": "^0.16.240",
7
+ "@parca/components": "^0.16.241",
8
8
  "@parca/dynamicsize": "^0.16.60",
9
9
  "@parca/hooks": "^0.0.38",
10
10
  "@parca/parser": "^0.16.68",
11
- "@parca/store": "^0.16.121",
12
- "@parca/utilities": "^0.0.49",
11
+ "@parca/store": "^0.16.122",
12
+ "@parca/utilities": "^0.0.50",
13
13
  "@tanstack/react-query": "^4.0.5",
14
14
  "@types/react-beautiful-dnd": "^13.1.3",
15
15
  "apache-arrow": "^12.0.0",
@@ -50,5 +50,5 @@
50
50
  "access": "public",
51
51
  "registry": "https://registry.npmjs.org/"
52
52
  },
53
- "gitHead": "d529dd87e642c1c67054ad2c68912d090e013321"
53
+ "gitHead": "4f536249850d27a79b365d3d796ca8ff692896d5"
54
54
  }
@@ -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 getClosest = (): HighlightedSeries | null => {
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
@@ -38,8 +38,7 @@ export interface ProfileSelection {
38
38
  Type: () => string;
39
39
  }
40
40
 
41
- export const timeFormat = "MMM d, 'at' h:mm:s a '(UTC)'";
42
- export const timeFormatShort = 'MMM d, h:mma';
41
+ export const timeFormat = "MMM d, 'at' HH:mm:ss '(UTC)'";
43
42
 
44
43
  export function ParamsString(params: {[key: string]: string}): string {
45
44
  return Object.keys(params)