@parca/profile 0.16.303 → 0.16.304
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 +4 -0
- package/dist/MetricsGraph/index.js +12 -4
- package/package.json +5 -5
- package/src/MetricsGraph/index.tsx +35 -24
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.304](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.303...@parca/profile@0.16.304) (2023-11-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## 0.16.303 (2023-11-09)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -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) =>
|
|
252
|
-
|
|
253
|
-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.304",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.16.98",
|
|
7
|
-
"@parca/components": "^0.16.
|
|
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.
|
|
12
|
-
"@parca/utilities": "^0.0.
|
|
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": "
|
|
53
|
+
"gitHead": "a342b32b3ed89bee6659d1f4fd073c6bcd52cb16"
|
|
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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
x2={
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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}
|