@parca/profile 0.16.303 → 0.16.305

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.305 (2023-11-15)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.304](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.303...@parca/profile@0.16.304) (2023-11-09)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## 0.16.303 (2023-11-09)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -14,7 +14,7 @@ import { divide, valueFormatter } from '@parca/utilities';
14
14
  import { FIELD_CUMULATIVE, FIELD_DIFF, FIELD_LOCATION_ADDRESS, } from '../../ProfileIcicleGraph/IcicleGraphArrow';
15
15
  import { getTextForCumulative, nodeLabel } from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
16
16
  export const useGraphTooltip = ({ table, unit, total, totalUnfiltered, row, level, }) => {
17
- if (row === null) {
17
+ if (row === null || row === 0) {
18
18
  return null;
19
19
  }
20
20
  const locationAddress = table.getChild(FIELD_LOCATION_ADDRESS)?.get(row) ?? 0n;
@@ -17,7 +17,7 @@ import { pointer } from 'd3-selection';
17
17
  import throttle from 'lodash.throttle';
18
18
  import { useContextMenu } from 'react-contexify';
19
19
  import { DateTimeRange } from '@parca/components';
20
- import { formatDate, formatForTimespan, sanitizeHighlightedValues, valueFormatter, } from '@parca/utilities';
20
+ import { formatDate, formatForTimespan, getPrecision, sanitizeHighlightedValues, valueFormatter, } from '@parca/utilities';
21
21
  import MetricsCircle from '../MetricsCircle';
22
22
  import MetricsSeries from '../MetricsSeries';
23
23
  import MetricsContextMenu from './MetricsContextMenu';
@@ -248,9 +248,17 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
248
248
  }
249
249
  return (_jsxs(_Fragment, { children: [_jsx(MetricsContextMenu, { onAddLabelMatcher: addLabelMatcher, menuId: MENU_ID, highlighted: highlighted, trackVisibility: trackVisibility }), 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: sampleUnit, delta: isDeltaType })) })), _jsx("div", { ref: graph, onMouseEnter: function () {
250
250
  setHovering(true);
251
- }, 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(5).map((d, i) => (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
252
- /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
253
- 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 }), _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: yAxisLabel }) })] }), _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",
251
+ }, 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(5).map((d, i, allTicks) => {
252
+ let decimals = 2;
253
+ const intervalBetweenTicks = allTicks[1] - allTicks[0];
254
+ if (intervalBetweenTicks < 1) {
255
+ const precision = getPrecision(intervalBetweenTicks);
256
+ decimals = precision;
257
+ }
258
+ return (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
259
+ /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
260
+ 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, 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()}`));
261
+ }), _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: yAxisLabel }) })] }), _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",
254
262
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
255
263
  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", { 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) => (_jsx("g", { className: "line", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
256
264
  ? lineStrokeHover
@@ -57,8 +57,8 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ table, row, map
57
57
  // get the actual values from the columns
58
58
  const mappingFile = arrowToString(mappingColumn?.get(row));
59
59
  const functionName = arrowToString(functionNameColumn?.get(row));
60
- const cumulative = BigInt(cumulativeColumn?.get(row));
61
- const diff = BigInt(diffColumn?.get(row));
60
+ const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
61
+ const diff = diffColumn?.get(row) !== null ? BigInt(diffColumn?.get(row)) : null;
62
62
  const childRows = Array.from(table.getChild(FIELD_CHILDREN)?.get(row) ?? []);
63
63
  // TODO: Maybe it's better to pass down the sorter function as prop instead of figuring this out here.
64
64
  switch (sortBy) {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.303",
3
+ "version": "0.16.305",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.98",
7
- "@parca/components": "^0.16.225",
7
+ "@parca/components": "^0.16.226",
8
8
  "@parca/dynamicsize": "^0.16.60",
9
9
  "@parca/hooks": "^0.0.35",
10
10
  "@parca/parser": "^0.16.66",
11
- "@parca/store": "^0.16.115",
12
- "@parca/utilities": "^0.0.43",
11
+ "@parca/store": "^0.16.116",
12
+ "@parca/utilities": "^0.0.44",
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": "29c127ca96914f6c9402e5052824868dee8c350e"
53
+ "gitHead": "42d5b5da9506741c6fa60aa756e7b8279861a8a7"
54
54
  }
@@ -48,7 +48,7 @@ export const useGraphTooltip = ({
48
48
  row,
49
49
  level,
50
50
  }: Props): GraphTooltipData | null => {
51
- if (row === null) {
51
+ if (row === null || row === 0) {
52
52
  return null;
53
53
  }
54
54
 
@@ -23,6 +23,7 @@ import {DateTimeRange} from '@parca/components';
23
23
  import {
24
24
  formatDate,
25
25
  formatForTimespan,
26
+ getPrecision,
26
27
  sanitizeHighlightedValues,
27
28
  valueFormatter,
28
29
  } from '@parca/utilities';
@@ -450,30 +451,40 @@ export const RawMetricsGraph = ({
450
451
  </g>
451
452
  <g transform={`translate(${margin * 1.5}, ${margin / 1.5})`}>
452
453
  <g className="y axis" textAnchor="end" fontSize="10" fill="none">
453
- {yScale.ticks(5).map((d, i) => (
454
- <Fragment key={`${i.toString()}-${d.toString()}`}>
455
- <g
456
- key={`tick-${i}`}
457
- className="tick"
458
- /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
459
- transform={`translate(0, ${yScale(d)})`}
460
- >
461
- <line className="stroke-gray-300 dark:stroke-gray-500" x2={-6} />
462
- <text fill="currentColor" x={-9} dy={'0.32em'}>
463
- {valueFormatter(d, sampleUnit, 1)}
464
- </text>
465
- </g>
466
- <g key={`grid-${i}`}>
467
- <line
468
- className="stroke-gray-300 dark:stroke-gray-500"
469
- x1={xScale(from)}
470
- x2={xScale(to)}
471
- y1={yScale(d)}
472
- y2={yScale(d)}
473
- />
474
- </g>
475
- </Fragment>
476
- ))}
454
+ {yScale.ticks(5).map((d, i, allTicks) => {
455
+ let decimals = 2;
456
+ const intervalBetweenTicks = allTicks[1] - allTicks[0];
457
+
458
+ if (intervalBetweenTicks < 1) {
459
+ const precision = getPrecision(intervalBetweenTicks);
460
+ decimals = precision;
461
+ }
462
+
463
+ return (
464
+ <Fragment key={`${i.toString()}-${d.toString()}`}>
465
+ <g
466
+ key={`tick-${i}`}
467
+ className="tick"
468
+ /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
469
+ transform={`translate(0, ${yScale(d)})`}
470
+ >
471
+ <line className="stroke-gray-300 dark:stroke-gray-500" x2={-6} />
472
+ <text fill="currentColor" x={-9} dy={'0.32em'}>
473
+ {valueFormatter(d, sampleUnit, decimals)}
474
+ </text>
475
+ </g>
476
+ <g key={`grid-${i}`}>
477
+ <line
478
+ className="stroke-gray-300 dark:stroke-gray-500"
479
+ x1={xScale(from)}
480
+ x2={xScale(to)}
481
+ y1={yScale(d)}
482
+ y2={yScale(d)}
483
+ />
484
+ </g>
485
+ </Fragment>
486
+ );
487
+ })}
477
488
  <line
478
489
  className="stroke-gray-300 dark:stroke-gray-500"
479
490
  x1={0}
@@ -194,8 +194,8 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({
194
194
  // get the actual values from the columns
195
195
  const mappingFile: string | null = arrowToString(mappingColumn?.get(row));
196
196
  const functionName: string | null = arrowToString(functionNameColumn?.get(row));
197
- const cumulative = BigInt(cumulativeColumn?.get(row));
198
- const diff: bigint | null = BigInt(diffColumn?.get(row));
197
+ const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
198
+ const diff: bigint | null = diffColumn?.get(row) !== null ? BigInt(diffColumn?.get(row)) : null;
199
199
  const childRows: number[] = Array.from(table.getChild(FIELD_CHILDREN)?.get(row) ?? []);
200
200
 
201
201
  // TODO: Maybe it's better to pass down the sorter function as prop instead of figuring this out here.