@parca/profile 0.16.184 → 0.16.186

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Callgraph/constants.js +2 -2
  3. package/dist/Callgraph/index.js +35 -45
  4. package/dist/Callgraph/mockData/index.js +28 -11
  5. package/dist/Callgraph/utils.js +51 -58
  6. package/dist/GraphTooltip/ExpandOnHoverValue.js +2 -14
  7. package/dist/GraphTooltip/index.d.ts +5 -5
  8. package/dist/GraphTooltip/index.js +96 -122
  9. package/dist/MatchersInput/SuggestionItem.js +5 -17
  10. package/dist/MatchersInput/SuggestionsList.js +29 -53
  11. package/dist/MatchersInput/index.js +58 -74
  12. package/dist/MetricsCircle/index.js +2 -16
  13. package/dist/MetricsGraph/MetricsTooltip/index.js +27 -53
  14. package/dist/MetricsGraph/index.js +79 -98
  15. package/dist/MetricsSeries/index.js +4 -19
  16. package/dist/ProfileExplorer/ProfileExplorerCompare.js +4 -16
  17. package/dist/ProfileExplorer/ProfileExplorerSingle.js +2 -14
  18. package/dist/ProfileExplorer/index.js +129 -88
  19. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.js +15 -31
  20. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.d.ts +4 -4
  21. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.js +38 -54
  22. package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +2 -2
  23. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +15 -31
  24. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.js +22 -26
  25. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +8 -9
  26. package/dist/ProfileIcicleGraph/IcicleGraph/utils.js +18 -20
  27. package/dist/ProfileIcicleGraph/index.d.ts +2 -2
  28. package/dist/ProfileIcicleGraph/index.js +18 -30
  29. package/dist/ProfileMetricsGraph/index.js +36 -88
  30. package/dist/ProfileSelector/CompareButton.js +8 -20
  31. package/dist/ProfileSelector/index.js +69 -69
  32. package/dist/ProfileSource.js +56 -65
  33. package/dist/ProfileTypeSelector/index.js +14 -28
  34. package/dist/ProfileView/FilterByFunctionButton.js +6 -7
  35. package/dist/ProfileView/ViewSelector.js +18 -31
  36. package/dist/ProfileView/VisualizationPanel.js +4 -16
  37. package/dist/ProfileView/index.js +72 -152
  38. package/dist/ProfileViewWithData.js +50 -101
  39. package/dist/TopTable/index.js +55 -63
  40. package/dist/components/DiffLegend.js +16 -28
  41. package/dist/components/ProfileShareButton/ResultBox.js +7 -21
  42. package/dist/components/ProfileShareButton/index.js +31 -90
  43. package/dist/useDelayedLoader.js +7 -8
  44. package/dist/useGrpcQuery/index.js +6 -48
  45. package/dist/useQuery.js +14 -58
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/utils.js +16 -68
  48. package/package.json +6 -6
  49. package/src/Callgraph/index.tsx +3 -3
  50. package/src/Callgraph/utils.ts +1 -1
  51. package/src/GraphTooltip/index.tsx +17 -17
  52. package/src/MetricsGraph/index.tsx +3 -3
  53. package/src/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.tsx +9 -10
  54. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +4 -8
  55. package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +2 -2
  56. package/src/ProfileIcicleGraph/index.tsx +8 -8
  57. package/src/ProfileView/index.tsx +2 -2
  58. package/src/TopTable/index.tsx +3 -3
  59. package/src/utils.ts +2 -2
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
2
  // Copyright 2022 The Parca Authors
14
3
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,96 +21,94 @@ import { formatDate, formatForTimespan, sanitizeHighlightedValues, valueFormatte
32
21
  import MetricsCircle from '../MetricsCircle';
33
22
  import MetricsSeries from '../MetricsSeries';
34
23
  import MetricsTooltip from './MetricsTooltip';
35
- var MetricsGraph = function (_a) {
36
- var data = _a.data, from = _a.from, to = _a.to, profile = _a.profile, onSampleClick = _a.onSampleClick, onLabelClick = _a.onLabelClick, setTimeRange = _a.setTimeRange, sampleUnit = _a.sampleUnit;
37
- var _b = useContainerDimensions(), ref = _b.ref, dimensions = _b.dimensions;
38
- return (_jsx("div", __assign({ ref: ref }, { children: _jsx(RawMetricsGraph, { data: data, from: from, to: to, profile: profile, onSampleClick: onSampleClick, onLabelClick: onLabelClick, setTimeRange: setTimeRange, sampleUnit: sampleUnit, width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width }) })));
24
+ const MetricsGraph = ({ data, from, to, profile, onSampleClick, onLabelClick, setTimeRange, sampleUnit, }) => {
25
+ const { ref, dimensions } = useContainerDimensions();
26
+ return (_jsx("div", { ref: ref, children: _jsx(RawMetricsGraph, { data: data, from: from, to: to, profile: profile, onSampleClick: onSampleClick, onLabelClick: onLabelClick, setTimeRange: setTimeRange, sampleUnit: sampleUnit, width: dimensions?.width }) }));
39
27
  };
40
28
  export default MetricsGraph;
41
- export var parseValue = function (value) {
42
- var val = parseFloat(value);
29
+ export const parseValue = (value) => {
30
+ const val = parseFloat(value);
43
31
  // "+Inf", "-Inf", "+Inf" will be parsed into NaN by parseFloat(). They
44
32
  // can't be graphed, so show them as gaps (null).
45
33
  return isNaN(val) ? null : val;
46
34
  };
47
- var lineStroke = '1px';
48
- var lineStrokeHover = '2px';
49
- export var RawMetricsGraph = function (_a) {
50
- var data = _a.data, from = _a.from, to = _a.to, profile = _a.profile, onSampleClick = _a.onSampleClick, onLabelClick = _a.onLabelClick, setTimeRange = _a.setTimeRange, width = _a.width, sampleUnit = _a.sampleUnit;
51
- var graph = useRef(null);
52
- var _b = useState(false), dragging = _b[0], setDragging = _b[1];
53
- var _c = useState(false), hovering = _c[0], setHovering = _c[1];
54
- var _d = useState(-1), relPos = _d[0], setRelPos = _d[1];
55
- var _e = useState([0, 0]), pos = _e[0], setPos = _e[1];
56
- var metricPointRef = useRef(null);
57
- var isShiftDown = useKeyDown().isShiftDown;
35
+ const lineStroke = '1px';
36
+ const lineStrokeHover = '2px';
37
+ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, onLabelClick, setTimeRange, width, sampleUnit, }) => {
38
+ const graph = useRef(null);
39
+ const [dragging, setDragging] = useState(false);
40
+ const [hovering, setHovering] = useState(false);
41
+ const [relPos, setRelPos] = useState(-1);
42
+ const [pos, setPos] = useState([0, 0]);
43
+ const metricPointRef = useRef(null);
44
+ const { isShiftDown } = useKeyDown();
58
45
  // the time of the selected point is the start of the merge window
59
- var time = parseFloat(profile === null || profile === void 0 ? void 0 : profile.HistoryParams().merge_from);
46
+ const time = parseFloat(profile?.HistoryParams().merge_from);
60
47
  if (width === undefined || width == null) {
61
48
  width = 0;
62
49
  }
63
- var height = Math.min(width / 2.5, 400);
64
- var margin = 50;
65
- var marginRight = 20;
66
- var series = data.reduce(function (agg, s) {
50
+ const height = Math.min(width / 2.5, 400);
51
+ const margin = 50;
52
+ const marginRight = 20;
53
+ const series = data.reduce(function (agg, s) {
67
54
  if (s.labelset !== undefined) {
68
- var metric = s.labelset.labels.sort(function (a, b) { return a.name.localeCompare(b.name); });
55
+ const metric = s.labelset.labels.sort((a, b) => a.name.localeCompare(b.name));
69
56
  agg.push({
70
- metric: metric,
57
+ metric,
71
58
  values: s.samples.reduce(function (agg, d) {
72
59
  if (d.timestamp !== undefined && d.valuePerSecond !== undefined) {
73
- var t = (+d.timestamp.seconds * 1e9 + d.timestamp.nanos) / 1e6; // https://github.com/microsoft/TypeScript/issues/5710#issuecomment-157886246
74
- agg.push([t, d.valuePerSecond, parseFloat(d.value), parseFloat(d.duration)]);
60
+ const t = (Number(d.timestamp.seconds) * 1e9 + d.timestamp.nanos) / 1e6; // https://github.com/microsoft/TypeScript/issues/5710#issuecomment-157886246
61
+ agg.push([t, d.valuePerSecond, Number(d.value), Number(d.duration)]);
75
62
  }
76
63
  return agg;
77
64
  }, []),
78
- labelset: metric.map(function (m) { return "".concat(m.name, "=").concat(m.value); }).join(','),
65
+ labelset: metric.map(m => `${m.name}=${m.value}`).join(','),
79
66
  });
80
67
  }
81
68
  return agg;
82
69
  }, []);
83
70
  // Sort series by id to make sure the colors are consistent
84
- series.sort(function (a, b) { return a.labelset.localeCompare(b.labelset); });
85
- var extentsY = series.map(function (s) {
71
+ series.sort((a, b) => a.labelset.localeCompare(b.labelset));
72
+ const extentsY = series.map(function (s) {
86
73
  return d3.extent(s.values, function (d) {
87
74
  return d[1];
88
75
  });
89
76
  });
90
- var minY = d3.min(extentsY, function (d) {
77
+ const minY = d3.min(extentsY, function (d) {
91
78
  return d[0];
92
79
  });
93
- var maxY = d3.max(extentsY, function (d) {
80
+ const maxY = d3.max(extentsY, function (d) {
94
81
  return d[1];
95
82
  });
96
83
  /* Scale */
97
- var xScale = d3
84
+ const xScale = d3
98
85
  .scaleUtc()
99
86
  .domain([from, to])
100
87
  .range([0, width - margin - marginRight]);
101
- var yScale = d3
88
+ const yScale = d3
102
89
  .scaleLinear()
103
90
  // tslint:disable-next-line
104
91
  .domain([minY, maxY])
105
92
  .range([height - margin, 0]);
106
- var color = d3.scaleOrdinal(d3.schemeCategory10);
107
- var l = d3.line(function (d) { return xScale(d[0]); }, function (d) { return yScale(d[1]); });
108
- var getClosest = function () {
109
- var closestPointPerSeries = series.map(function (s) {
110
- var distances = s.values.map(function (d) {
111
- var x = xScale(d[0]);
112
- var y = yScale(d[1]);
93
+ const color = d3.scaleOrdinal(d3.schemeCategory10);
94
+ const l = d3.line(d => xScale(d[0]), d => yScale(d[1]));
95
+ const getClosest = () => {
96
+ const closestPointPerSeries = series.map(function (s) {
97
+ const distances = s.values.map(d => {
98
+ const x = xScale(d[0]);
99
+ const y = yScale(d[1]);
113
100
  return Math.sqrt(Math.pow(pos[0] - x, 2) + Math.pow(pos[1] - y, 2));
114
101
  });
115
- var pointIndex = d3.minIndex(distances);
116
- var minDistance = distances[pointIndex];
102
+ const pointIndex = d3.minIndex(distances);
103
+ const minDistance = distances[pointIndex];
117
104
  return {
118
- pointIndex: pointIndex,
105
+ pointIndex,
119
106
  distance: minDistance,
120
107
  };
121
108
  });
122
- var closestSeriesIndex = d3.minIndex(closestPointPerSeries, function (s) { return s.distance; });
123
- var pointIndex = closestPointPerSeries[closestSeriesIndex].pointIndex;
124
- var point = series[closestSeriesIndex].values[pointIndex];
109
+ const closestSeriesIndex = d3.minIndex(closestPointPerSeries, s => s.distance);
110
+ const pointIndex = closestPointPerSeries[closestSeriesIndex].pointIndex;
111
+ const point = series[closestSeriesIndex].values[pointIndex];
125
112
  return {
126
113
  seriesIndex: closestSeriesIndex,
127
114
  labels: series[closestSeriesIndex].metric,
@@ -133,8 +120,8 @@ export var RawMetricsGraph = function (_a) {
133
120
  y: yScale(point[1]),
134
121
  };
135
122
  };
136
- var highlighted = getClosest();
137
- var onMouseDown = function (e) {
123
+ const highlighted = getClosest();
124
+ const onMouseDown = (e) => {
138
125
  // if shift is down, disable mouse behavior
139
126
  if (isShiftDown) {
140
127
  return;
@@ -144,9 +131,9 @@ export var RawMetricsGraph = function (_a) {
144
131
  return;
145
132
  }
146
133
  // X/Y coordinate array relative to svg
147
- var rel = pointer(e);
148
- var xCoordinate = rel[0];
149
- var xCoordinateWithoutMargin = xCoordinate - margin;
134
+ const rel = pointer(e);
135
+ const xCoordinate = rel[0];
136
+ const xCoordinateWithoutMargin = xCoordinate - margin;
150
137
  if (xCoordinateWithoutMargin >= 0) {
151
138
  setRelPos(xCoordinateWithoutMargin);
152
139
  setDragging(true);
@@ -154,13 +141,13 @@ export var RawMetricsGraph = function (_a) {
154
141
  e.stopPropagation();
155
142
  e.preventDefault();
156
143
  };
157
- var openClosestProfile = function () {
144
+ const openClosestProfile = () => {
158
145
  if (highlighted != null) {
159
146
  onSampleClick(Math.round(highlighted.timestamp), highlighted.value, sanitizeHighlightedValues(highlighted.labels) // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
160
147
  );
161
148
  }
162
149
  };
163
- var onMouseUp = function (e) {
150
+ const onMouseUp = (e) => {
164
151
  if (isShiftDown) {
165
152
  return;
166
153
  }
@@ -176,8 +163,8 @@ export var RawMetricsGraph = function (_a) {
176
163
  setRelPos(-1);
177
164
  return;
178
165
  }
179
- var firstTime = xScale.invert(relPos).valueOf();
180
- var secondTime = xScale.invert(pos[0]).valueOf();
166
+ const firstTime = xScale.invert(relPos).valueOf();
167
+ const secondTime = xScale.invert(pos[0]).valueOf();
181
168
  if (firstTime > secondTime) {
182
169
  setTimeRange(DateTimeRange.fromAbsoluteDates(secondTime, firstTime));
183
170
  }
@@ -188,42 +175,36 @@ export var RawMetricsGraph = function (_a) {
188
175
  e.stopPropagation();
189
176
  e.preventDefault();
190
177
  };
191
- var throttledSetPos = throttle(setPos, 20);
192
- var onMouseMove = function (e) {
178
+ const throttledSetPos = throttle(setPos, 20);
179
+ const onMouseMove = (e) => {
193
180
  // do not update position if shift is down because this means the user is locking the tooltip
194
181
  if (isShiftDown) {
195
182
  return;
196
183
  }
197
184
  // X/Y coordinate array relative to svg
198
- var rel = pointer(e);
199
- var xCoordinate = rel[0];
200
- var xCoordinateWithoutMargin = xCoordinate - margin;
201
- var yCoordinate = rel[1];
202
- var yCoordinateWithoutMargin = yCoordinate - margin;
185
+ const rel = pointer(e);
186
+ const xCoordinate = rel[0];
187
+ const xCoordinateWithoutMargin = xCoordinate - margin;
188
+ const yCoordinate = rel[1];
189
+ const yCoordinateWithoutMargin = yCoordinate - margin;
203
190
  throttledSetPos([xCoordinateWithoutMargin, yCoordinateWithoutMargin]);
204
191
  };
205
- var findSelectedProfile = function () {
192
+ const findSelectedProfile = () => {
206
193
  if (profile == null) {
207
194
  return null;
208
195
  }
209
- var s = null;
210
- var seriesIndex = -1;
211
- outer: for (var i = 0; i < series.length; i++) {
212
- var keys = profile.query.matchers.map(function (e) { return e.key; });
213
- var _loop_1 = function (j) {
214
- var matcherKey = keys[j];
215
- var label = series[i].metric.find(function (e) { return e.name === matcherKey; });
196
+ let s = null;
197
+ let seriesIndex = -1;
198
+ outer: for (let i = 0; i < series.length; i++) {
199
+ const keys = profile.query.matchers.map(e => e.key);
200
+ for (let j = 0; j < keys.length; j++) {
201
+ const matcherKey = keys[j];
202
+ const label = series[i].metric.find(e => e.name === matcherKey);
216
203
  if (label === undefined) {
217
- return "continue-outer";
204
+ continue outer; // label doesn't exist to begin with
218
205
  }
219
206
  if (profile.query.matchers[j].value !== label.value) {
220
- return "continue-outer";
221
- }
222
- };
223
- for (var j = 0; j < keys.length; j++) {
224
- var state_1 = _loop_1(j);
225
- switch (state_1) {
226
- case "continue-outer": continue outer;
207
+ continue outer; // label values don't match
227
208
  }
228
209
  }
229
210
  seriesIndex = i;
@@ -233,7 +214,7 @@ export var RawMetricsGraph = function (_a) {
233
214
  return null;
234
215
  }
235
216
  // Find the sample that matches the timestamp
236
- var sample = s.values.find(function (v) {
217
+ const sample = s.values.find(v => {
237
218
  return Math.round(v[0]) === time;
238
219
  });
239
220
  if (sample === undefined) {
@@ -241,7 +222,7 @@ export var RawMetricsGraph = function (_a) {
241
222
  }
242
223
  return {
243
224
  labels: [],
244
- seriesIndex: seriesIndex,
225
+ seriesIndex,
245
226
  timestamp: sample[0],
246
227
  valuePerSecond: sample[1],
247
228
  value: sample[2],
@@ -250,16 +231,16 @@ export var RawMetricsGraph = function (_a) {
250
231
  y: yScale(sample[1]),
251
232
  };
252
233
  };
253
- var selected = findSelectedProfile();
254
- return (_jsxs(_Fragment, { children: [highlighted != null && hovering && !dragging && pos[0] !== 0 && pos[1] !== 0 && (_jsx("div", __assign({ onMouseMove: onMouseMove, onMouseEnter: function () { return setHovering(true); }, onMouseLeave: function () { return 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 === null || profile === void 0 ? void 0 : profile.query.profType.delta : false }) }))), _jsx("div", __assign({ ref: graph, onMouseEnter: function () {
234
+ const selected = findSelectedProfile();
235
+ 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 () {
255
236
  setHovering(true);
256
- }, onMouseLeave: function () { return setHovering(false); } }, { children: _jsxs("svg", __assign({ width: "".concat(width, "px"), height: "".concat(height + margin, "px"), onMouseDown: onMouseDown, onMouseUp: onMouseUp, onMouseMove: onMouseMove }, { children: [_jsx("g", __assign({ transform: "translate(".concat(margin, ", 0)") }, { children: dragging && (_jsx("g", __assign({ 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", __assign({ transform: "translate(".concat(margin, ", ").concat(margin, ")") }, { children: [_jsx("g", __assign({ className: "lines fill-transparent" }, { children: series.map(function (s, i) { return (_jsx("g", __assign({ className: "line" }, { children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
237
+ }, 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: [_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
257
238
  ? lineStrokeHover
258
- : lineStroke, xScale: xScale, yScale: yScale }) }), i)); }) })), hovering && highlighted != null && (_jsx("g", __assign({ className: "circle-group", ref: metricPointRef, style: { fill: color(highlighted.seriesIndex.toString()) } }, { children: _jsx(MetricsCircle, { cx: highlighted.x, cy: highlighted.y }) }))), selected != null && (_jsx("g", __assign({ className: "circle-group", style: (selected === null || selected === void 0 ? void 0 : selected.seriesIndex) != null
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
259
240
  ? { fill: color(selected.seriesIndex.toString()) }
260
- : {} }, { children: _jsx(MetricsCircle, { cx: selected.x, cy: selected.y, radius: 5 }) }))), _jsx("g", __assign({ className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: "translate(0,".concat(height - margin, ")") }, { children: xScale.ticks(5).map(function (d, i) { return (_jsxs("g", __assign({ className: "tick",
241
+ : {}, children: _jsx(MetricsCircle, { cx: selected.x, cy: selected.y, radius: 5 }) })), _jsx("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: xScale.ticks(5).map((d, i) => (_jsxs("g", { className: "tick",
261
242
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
262
- transform: "translate(".concat(xScale(d), ", 0)") }, { children: [_jsx("line", { y2: 6, stroke: "currentColor" }), _jsx("text", __assign({ fill: "currentColor", dy: ".71em", y: 9 }, { children: formatDate(d, formatForTimespan(from, to)) }))] }), i)); }) })), _jsx("g", __assign({ className: "y axis", textAnchor: "end", fontSize: "10", fill: "none" }, { children: yScale.ticks(3).map(function (d, i) { return (_jsxs("g", __assign({ className: "tick",
243
+ transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, stroke: "currentColor" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to)) })] }, i))) }), _jsx("g", { className: "y axis", textAnchor: "end", fontSize: "10", fill: "none", children: yScale.ticks(3).map((d, i) => (_jsxs("g", { className: "tick",
263
244
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
264
- transform: "translate(0, ".concat(yScale(d), ")") }, { children: [_jsx("line", { stroke: "currentColor", x2: -6 }), _jsx("text", __assign({ fill: "currentColor", x: -9, dy: '0.32em' }, { children: valueFormatter(d, sampleUnit, 1) }))] }), i)); }) }))] }))] })) }))] }));
245
+ transform: `translate(0, ${yScale(d)})`, children: [_jsx("line", { stroke: "currentColor", x2: -6 }), _jsx("text", { fill: "currentColor", x: -9, dy: '0.32em', children: valueFormatter(1000, sampleUnit, 1) })] }, i))) })] })] }) })] }));
265
246
  };
@@ -1,21 +1,6 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
- var MetricsSeries = function (_a) {
14
- var _b;
15
- var data = _a.data, line = _a.line, color = _a.color, strokeWidth = _a.strokeWidth;
16
- return (_jsx("g", __assign({ className: "line-group" }, { children: _jsx("path", { className: "line", d: (_b = line(data.values)) !== null && _b !== void 0 ? _b : undefined, style: {
17
- stroke: color,
18
- strokeWidth: strokeWidth,
19
- } }) })));
20
- };
2
+ const MetricsSeries = ({ data, line, color, strokeWidth }) => (_jsx("g", { className: "line-group", children: _jsx("path", { className: "line", d: line(data.values) ?? undefined, style: {
3
+ stroke: color,
4
+ strokeWidth,
5
+ } }) }));
21
6
  export default MetricsSeries;
@@ -1,26 +1,14 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
2
  import { Query } from '@parca/parser';
14
3
  import { ProfileDiffSource, ProfileViewWithData } from '..';
15
4
  import ProfileSelector from '../ProfileSelector';
16
- var ProfileExplorerCompare = function (_a) {
17
- var queryClient = _a.queryClient, queryA = _a.queryA, queryB = _a.queryB, profileA = _a.profileA, profileB = _a.profileB, selectQueryA = _a.selectQueryA, selectQueryB = _a.selectQueryB, selectProfileA = _a.selectProfileA, selectProfileB = _a.selectProfileB, closeProfile = _a.closeProfile, navigateTo = _a.navigateTo;
18
- var closeProfileA = function () {
5
+ const ProfileExplorerCompare = ({ queryClient, queryA, queryB, profileA, profileB, selectQueryA, selectQueryB, selectProfileA, selectProfileB, closeProfile, navigateTo, }) => {
6
+ const closeProfileA = () => {
19
7
  closeProfile('A');
20
8
  };
21
- var closeProfileB = function () {
9
+ const closeProfileB = () => {
22
10
  closeProfile('B');
23
11
  };
24
- return (_jsxs(_Fragment, { children: [_jsxs("div", __assign({ className: "grid grid-cols-2" }, { children: [_jsx("div", __assign({ className: "pr-2" }, { children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryA, profileSelection: profileA, selectProfile: selectProfileA, selectQuery: selectQueryA, closeProfile: closeProfileA, enforcedProfileName: '', comparing: true, onCompareProfile: function () { } }) })), _jsx("div", __assign({ className: "pl-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: function () { } }) }))] })), _jsx("div", __assign({ className: "grid grid-cols-1" }, { children: profileA != null && profileB != null ? (_jsx(ProfileViewWithData, { navigateTo: navigateTo, queryClient: queryClient, profileSource: new ProfileDiffSource(profileA.ProfileSource(), profileB.ProfileSource()) })) : (_jsx("div", { children: _jsx("div", __assign({ className: "my-20 text-center" }, { children: _jsx("p", { children: "Select a profile on both sides." }) })) })) }))] }));
12
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-2", children: [_jsx("div", { className: "pr-2", children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: queryA, profileSelection: profileA, selectProfile: selectProfileA, selectQuery: selectQueryA, closeProfile: closeProfileA, enforcedProfileName: '', comparing: true, onCompareProfile: () => { } }) }), _jsx("div", { className: "pl-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(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." }) }) })) })] }));
25
13
  };
26
14
  export default ProfileExplorerCompare;
@@ -1,19 +1,7 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
2
  import { ProfileViewWithData } from '..';
14
3
  import ProfileSelector from '../ProfileSelector';
15
- var ProfileExplorerSingle = function (_a) {
16
- var queryClient = _a.queryClient, query = _a.query, selectQuery = _a.selectQuery, selectProfile = _a.selectProfile, profile = _a.profile, compareProfile = _a.compareProfile, navigateTo = _a.navigateTo;
17
- return (_jsxs(_Fragment, { children: [_jsx("div", __assign({ className: "grid grid-cols-1" }, { children: _jsx("div", { children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: query, selectQuery: selectQuery, selectProfile: selectProfile, closeProfile: function () { }, profileSelection: profile, comparing: false, onCompareProfile: compareProfile, enforcedProfileName: '' }) }) })), _jsx("div", __assign({ className: "grid grid-cols-1" }, { children: _jsx("div", { children: profile != null ? (_jsx(ProfileViewWithData, { queryClient: queryClient, profileSource: profile.ProfileSource(), navigateTo: navigateTo })) : (_jsx(_Fragment, {})) }) }))] }));
4
+ const ProfileExplorerSingle = ({ queryClient, query, selectQuery, selectProfile, profile, compareProfile, navigateTo, }) => {
5
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid grid-cols-1", children: _jsx("div", { children: _jsx(ProfileSelector, { queryClient: queryClient, querySelection: query, selectQuery: selectQuery, selectProfile: selectProfile, closeProfile: () => { }, profileSelection: profile, comparing: false, onCompareProfile: compareProfile, enforcedProfileName: '' }) }) }), _jsx("div", { className: "grid grid-cols-1", children: _jsx("div", { children: profile != null ? (_jsx(ProfileViewWithData, { queryClient: queryClient, profileSource: profile.ProfileSource(), navigateTo: navigateTo })) : (_jsx(_Fragment, {})) }) })] }));
18
6
  };
19
7
  export default ProfileExplorerSingle;