@parca/profile 0.19.139 → 0.19.142
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 +8 -0
- package/dist/GraphTooltipArrow/Content.js +224 -30
- package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
- package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
- package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/index.js +86 -56
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +103 -73
- package/dist/MatchersInput/SuggestionItem.js +91 -12
- package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
- package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
- package/dist/MatchersInput/SuggestionsList.js +371 -157
- package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
- package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
- package/dist/MatchersInput/index.js +308 -115
- package/dist/MetricsCircle/index.js +39 -3
- package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
- package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
- package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
- package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
- package/dist/MetricsGraph/index.js +552 -203
- package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
- package/dist/MetricsGraph/utils/colorMapping.js +24 -17
- package/dist/MetricsSeries/index.js +70 -7
- package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
- package/dist/PreSelectedMatchers/index.js +249 -102
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -49
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
- package/dist/ProfileExplorer/index.js +183 -32
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
- package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
- package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.js +266 -134
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
- package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
- package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
- package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
- package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
- package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
- package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
- package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
- package/dist/ProfileFlameGraph/index.js +324 -148
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.js +518 -259
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +730 -142
- package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
- package/dist/ProfileSource.js +230 -163
- package/dist/ProfileTypeSelector/index.js +214 -125
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +139 -33
- package/dist/ProfileView/components/ColorStackLegend.js +184 -55
- package/dist/ProfileView/components/DashboardItems/index.js +87 -28
- package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
- package/dist/ProfileView/components/DiffLegend.js +172 -29
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
- package/dist/ProfileView/components/InvertCallStack/index.js +99 -10
- package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
- package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -120
- package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
- package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
- package/dist/ProfileView/components/ShareButton/index.js +352 -62
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +675 -195
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.js +211 -91
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
- package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
- package/dist/ProfileView/components/VisualizationPanel.js +185 -8
- package/dist/ProfileView/context/DashboardContext.js +84 -28
- package/dist/ProfileView/context/ProfileViewContext.js +56 -15
- package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
- package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
- package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
- package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
- package/dist/ProfileView/index.js +383 -45
- package/dist/ProfileView/types/visualization.js +1 -13
- package/dist/ProfileView/utils/colorUtils.js +8 -7
- package/dist/ProfileViewWithData.js +332 -237
- package/dist/QueryControls/index.js +418 -47
- package/dist/Sandwich/components/CalleesSection.js +54 -4
- package/dist/Sandwich/components/CallersSection.js +97 -27
- package/dist/Sandwich/components/TableSection.js +77 -4
- package/dist/Sandwich/index.js +125 -12
- package/dist/Sandwich/utils/processRowData.js +48 -39
- package/dist/SelectWithRefresh/index.js +102 -28
- package/dist/SimpleMatchers/Select.js +520 -187
- package/dist/SimpleMatchers/index.js +590 -288
- package/dist/SourceView/Highlighter.js +230 -70
- package/dist/SourceView/LineNo.js +72 -17
- package/dist/SourceView/index.js +177 -101
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.js +97 -16
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.js +121 -27
- package/dist/Table/TableContextMenu.js +150 -139
- package/dist/Table/TableContextMenuWrapper.js +59 -14
- package/dist/Table/hooks/useColorManagement.js +58 -16
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
- package/dist/Table/hooks/useTableConfiguration.js +331 -168
- package/dist/Table/index.js +222 -126
- package/dist/Table/utils/functions.js +169 -144
- package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
- package/dist/TimelineGuide/index.js +209 -16
- package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
- package/dist/TopTable/index.js +340 -122
- package/dist/contexts/LabelsQueryProvider.js +94 -32
- package/dist/contexts/UnifiedLabelsContext.js +114 -49
- package/dist/contexts/utils.js +37 -15
- package/dist/hooks/useCompareModeMeta.js +157 -94
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.js +371 -330
- package/dist/index.js +21 -16
- package/dist/testdata/fg-diff.json +3750 -0
- package/dist/testdata/fg-simple.json +1879 -0
- package/dist/testdata/link_data.json +56 -0
- package/dist/testdata/tabular.json +30 -0
- package/dist/testdata/test_flamegraph.json +26846 -0
- package/dist/testdata/test_graph.json +53 -0
- package/dist/useDelayedLoader.js +32 -18
- package/dist/useGrpcQuery/index.js +71 -11
- package/dist/useHasProfileData.js +90 -12
- package/dist/useQuery.js +205 -64
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -9
- package/src/GraphTooltipArrow/index.tsx +3 -0
- package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
- package/src/MatchersInput/SuggestionsList.tsx +11 -10
- package/src/MatchersInput/index.tsx +1 -1
- package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
- package/src/PreSelectedMatchers/index.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
- package/src/ProfileSelector/index.tsx +30 -7
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/Table/hooks/useTableConfiguration.tsx +7 -13
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +12 -18
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
- package/dist/hooks/useQueryState.test.js +0 -984
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import { c as _c } from "react-compiler-runtime";
|
|
2
14
|
// Copyright 2022 The Parca Authors
|
|
3
15
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
16
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,11 +23,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
23
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
24
|
// See the License for the specific language governing permissions and
|
|
13
25
|
// limitations under the License.
|
|
14
|
-
|
|
26
|
+
|
|
27
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
28
|
import cx from 'classnames';
|
|
16
29
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
17
30
|
import { useMeasure } from 'react-use';
|
|
18
|
-
import { FlameGraphSkeleton, SandwichFlameGraphSkeleton, useParcaContext, useURLState
|
|
31
|
+
import { FlameGraphSkeleton, SandwichFlameGraphSkeleton, useParcaContext, useURLState } from '@parca/components';
|
|
19
32
|
import { TEST_IDS, testId } from '@parca/test-utils';
|
|
20
33
|
import { capitalizeOnlyFirstLetter, divide } from '@parca/utilities';
|
|
21
34
|
import DiffLegend from '../ProfileView/components/DiffLegend';
|
|
@@ -23,153 +36,316 @@ import { useProfileViewContext } from '../ProfileView/context/ProfileViewContext
|
|
|
23
36
|
import { useProfileMetadata } from '../ProfileView/hooks/useProfileMetadata';
|
|
24
37
|
import { useVisualizationState } from '../ProfileView/hooks/useVisualizationState';
|
|
25
38
|
import { FlameGraphArrow } from './FlameGraphArrow';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
40
|
+
var numberFormatter = new Intl.NumberFormat('en-US');
|
|
41
|
+
var ErrorContent = function ErrorContent(t0) {
|
|
42
|
+
var $ = _c(2);
|
|
43
|
+
var errorMessage = t0.errorMessage;
|
|
44
|
+
var t1;
|
|
45
|
+
if ($[0] !== errorMessage) {
|
|
46
|
+
t1 = /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: "flex flex-col justify-center p-10 text-center gap-6 text-sm",
|
|
48
|
+
children: errorMessage
|
|
49
|
+
});
|
|
50
|
+
$[0] = errorMessage;
|
|
51
|
+
$[1] = t1;
|
|
52
|
+
} else {
|
|
53
|
+
t1 = $[1];
|
|
54
|
+
}
|
|
55
|
+
return t1;
|
|
29
56
|
};
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
export var validateFlameChartQuery = function validateFlameChartQuery(profileSource) {
|
|
58
|
+
var isNonDelta = !profileSource.ProfileType().delta;
|
|
59
|
+
var duration = profileSource.mergeTo - profileSource.mergeFrom;
|
|
60
|
+
var isDurationTooLong = duration > 900000000000n; // 15 minutes in nanoseconds
|
|
61
|
+
return {
|
|
62
|
+
isValid: !isNonDelta && !isDurationTooLong,
|
|
63
|
+
isNonDelta: isNonDelta,
|
|
64
|
+
isDurationTooLong: isDurationTooLong
|
|
65
|
+
};
|
|
35
66
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
var ProfileFlameGraph = function ProfileFlameGraphNonMemo(_ref) {
|
|
68
|
+
var arrow = _ref.arrow,
|
|
69
|
+
total = _ref.total,
|
|
70
|
+
filtered = _ref.filtered,
|
|
71
|
+
curPathArrow = _ref.curPathArrow,
|
|
72
|
+
setNewCurPathArrow = _ref.setNewCurPathArrow,
|
|
73
|
+
profileType = _ref.profileType,
|
|
74
|
+
loading = _ref.loading,
|
|
75
|
+
error = _ref.error,
|
|
76
|
+
width = _ref.width,
|
|
77
|
+
isHalfScreen = _ref.isHalfScreen,
|
|
78
|
+
metadataMappingFiles = _ref.metadataMappingFiles,
|
|
79
|
+
_ref$isFlameChart = _ref.isFlameChart,
|
|
80
|
+
isFlameChart = _ref$isFlameChart === void 0 ? false : _ref$isFlameChart,
|
|
81
|
+
profileSource = _ref.profileSource,
|
|
82
|
+
_ref$isInSandwichView = _ref.isInSandwichView,
|
|
83
|
+
isInSandwichView = _ref$isInSandwichView === void 0 ? false : _ref$isInSandwichView,
|
|
84
|
+
_ref$isRenderedAsFlam = _ref.isRenderedAsFlamegraph,
|
|
85
|
+
isRenderedAsFlamegraph = _ref$isRenderedAsFlam === void 0 ? false : _ref$isRenderedAsFlam,
|
|
86
|
+
tooltipId = _ref.tooltipId,
|
|
87
|
+
maxFrameCount = _ref.maxFrameCount,
|
|
88
|
+
_ref$isExpanded = _ref.isExpanded,
|
|
89
|
+
isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
|
|
90
|
+
_ref$metadataLoading = _ref.metadataLoading,
|
|
91
|
+
metadataLoading = _ref$metadataLoading === void 0 ? false : _ref$metadataLoading,
|
|
92
|
+
zoomControlsRef = _ref.zoomControlsRef;
|
|
93
|
+
var _useParcaContext = useParcaContext(),
|
|
94
|
+
onError = _useParcaContext.onError,
|
|
95
|
+
authenticationErrorMessage = _useParcaContext.authenticationErrorMessage,
|
|
96
|
+
isDarkMode = _useParcaContext.isDarkMode,
|
|
97
|
+
flamechartHelpText = _useParcaContext.flamechartHelpText;
|
|
98
|
+
var _useProfileViewContex = useProfileViewContext(),
|
|
99
|
+
compareMode = _useProfileViewContex.compareMode;
|
|
100
|
+
var _useState = useState(true),
|
|
101
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
102
|
+
isLoading = _useState2[0],
|
|
103
|
+
setIsLoading = _useState2[1];
|
|
104
|
+
var _useMeasure = useMeasure(),
|
|
105
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 1),
|
|
106
|
+
flameChartRef = _useMeasure2[0];
|
|
107
|
+
var _useVisualizationStat = useVisualizationState(),
|
|
108
|
+
colorBy = _useVisualizationStat.colorBy,
|
|
109
|
+
setColorBy = _useVisualizationStat.setColorBy;
|
|
110
|
+
|
|
111
|
+
// Create local state for paths when in sandwich view to avoid URL updates
|
|
112
|
+
var _useState3 = useState([]),
|
|
113
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
114
|
+
localCurPathArrow = _useState4[0],
|
|
115
|
+
setLocalCurPathArrow = _useState4[1];
|
|
116
|
+
var setCurPathArrowWrapper = useCallback(function (path) {
|
|
117
|
+
if (isInSandwichView) {
|
|
118
|
+
setLocalCurPathArrow(path);
|
|
119
|
+
} else {
|
|
120
|
+
setNewCurPathArrow(path);
|
|
121
|
+
}
|
|
122
|
+
}, [isInSandwichView, setNewCurPathArrow]);
|
|
123
|
+
|
|
124
|
+
// Determine which paths to use based on isInSandwichView flag
|
|
125
|
+
var effectiveCurPathArrow = isInSandwichView ? localCurPathArrow : curPathArrow;
|
|
126
|
+
var _useProfileMetadata = useProfileMetadata({
|
|
127
|
+
flamegraphArrow: arrow,
|
|
128
|
+
metadataMappingFiles: metadataMappingFiles,
|
|
129
|
+
metadataLoading: metadataLoading,
|
|
130
|
+
colorBy: colorBy
|
|
131
|
+
}),
|
|
132
|
+
mappingsList = _useProfileMetadata.mappingsList,
|
|
133
|
+
filenamesList = _useProfileMetadata.filenamesList;
|
|
134
|
+
|
|
135
|
+
// By default, we want delta profiles (CPU) to be relatively compared.
|
|
136
|
+
// For non-delta profiles, like goroutines or memory, we want the profiles to be compared absolutely.
|
|
137
|
+
var compareAbsoluteDefault = (profileType === null || profileType === void 0 ? void 0 : profileType.delta) === false ? 'true' : 'false';
|
|
138
|
+
var _useURLState = useURLState('compare_absolute'),
|
|
139
|
+
_useURLState2 = _slicedToArray(_useURLState, 1),
|
|
140
|
+
_useURLState2$ = _useURLState2[0],
|
|
141
|
+
compareAbsolute = _useURLState2$ === void 0 ? compareAbsoluteDefault : _useURLState2$;
|
|
142
|
+
var isCompareAbsolute = compareAbsolute === 'true';
|
|
143
|
+
var mappingsListCount = useMemo(function () {
|
|
144
|
+
return mappingsList.filter(function (m) {
|
|
145
|
+
return m !== '';
|
|
146
|
+
}).length;
|
|
147
|
+
}, [mappingsList]);
|
|
148
|
+
var _useMemo = useMemo(function () {
|
|
149
|
+
var _arrow$trimmed;
|
|
150
|
+
if (arrow === undefined) {
|
|
151
|
+
return ['0', '0', false, '0', '0', false, '0', '0'];
|
|
152
|
+
}
|
|
153
|
+
var trimmed = (_arrow$trimmed = arrow === null || arrow === void 0 ? void 0 : arrow.trimmed) !== null && _arrow$trimmed !== void 0 ? _arrow$trimmed : 0n;
|
|
154
|
+
var totalUnfiltered = total + filtered;
|
|
155
|
+
// safeguard against division by zero
|
|
156
|
+
var totalUnfilteredDivisor = totalUnfiltered > 0 ? totalUnfiltered : 1n;
|
|
157
|
+
return [numberFormatter.format(total), numberFormatter.format(totalUnfiltered), trimmed > 0, numberFormatter.format(trimmed), numberFormatter.format(divide(trimmed * 100n, totalUnfilteredDivisor)), filtered > 0, numberFormatter.format(divide(total * 100n, totalUnfilteredDivisor))];
|
|
158
|
+
}, [arrow, filtered, total]),
|
|
159
|
+
_useMemo2 = _slicedToArray(_useMemo, 7),
|
|
160
|
+
totalFormatted = _useMemo2[0],
|
|
161
|
+
totalUnfilteredFormatted = _useMemo2[1],
|
|
162
|
+
isTrimmed = _useMemo2[2],
|
|
163
|
+
trimmedFormatted = _useMemo2[3],
|
|
164
|
+
trimmedPercentage = _useMemo2[4],
|
|
165
|
+
isFiltered = _useMemo2[5],
|
|
166
|
+
filteredPercentage = _useMemo2[6];
|
|
167
|
+
var loadingState = !loading && arrow !== undefined && metadataMappingFiles !== undefined;
|
|
168
|
+
|
|
169
|
+
// If there is only one mapping file, we want to color by filename by default.
|
|
170
|
+
useEffect(function () {
|
|
171
|
+
if (mappingsListCount === 1 && colorBy !== 'filename') {
|
|
172
|
+
setColorBy('filename');
|
|
173
|
+
}
|
|
174
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
|
+
}, [mappingsListCount]);
|
|
176
|
+
useEffect(function () {
|
|
177
|
+
if (loadingState) {
|
|
178
|
+
setIsLoading(false);
|
|
179
|
+
} else {
|
|
180
|
+
setIsLoading(true);
|
|
181
|
+
}
|
|
182
|
+
}, [loadingState]);
|
|
183
|
+
var flameGraph = useMemo(function () {
|
|
184
|
+
var _ref2 = isFlameChart ? validateFlameChartQuery(profileSource) : {
|
|
185
|
+
isValid: true,
|
|
186
|
+
isNonDelta: false,
|
|
187
|
+
isDurationTooLong: false
|
|
188
|
+
},
|
|
189
|
+
isFlameChartValid = _ref2.isValid,
|
|
190
|
+
isNonDelta = _ref2.isNonDelta,
|
|
191
|
+
isDurationTooLong = _ref2.isDurationTooLong;
|
|
192
|
+
var isInvalidFlameChartQuery = isFlameChart && !isFlameChartValid;
|
|
193
|
+
if (isLoading && !isInvalidFlameChartQuery) {
|
|
194
|
+
return /*#__PURE__*/_jsx("div", {
|
|
195
|
+
className: "h-auto overflow-clip",
|
|
196
|
+
"data-testid": TEST_IDS.FLAMEGRAPH_SKELETON,
|
|
197
|
+
children: isRenderedAsFlamegraph ? /*#__PURE__*/_jsx(SandwichFlameGraphSkeleton, {
|
|
198
|
+
isHalfScreen: isHalfScreen,
|
|
199
|
+
isDarkMode: isDarkMode
|
|
200
|
+
}) : /*#__PURE__*/_jsx(FlameGraphSkeleton, {
|
|
201
|
+
isHalfScreen: isHalfScreen,
|
|
202
|
+
isDarkMode: isDarkMode
|
|
203
|
+
})
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Do necessary checks to ensure that flame chart can be rendered for this query.
|
|
208
|
+
if (isInvalidFlameChartQuery) {
|
|
209
|
+
if (isNonDelta) {
|
|
210
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
211
|
+
errorMessage: /*#__PURE__*/_jsxs(_Fragment, {
|
|
212
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
213
|
+
children: "To use the Flame chart, please switch to a Delta profile."
|
|
214
|
+
}), flamechartHelpText !== null && flamechartHelpText !== void 0 ? flamechartHelpText : null]
|
|
215
|
+
})
|
|
216
|
+
});
|
|
217
|
+
} else if (isDurationTooLong) {
|
|
218
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
219
|
+
errorMessage: /*#__PURE__*/_jsxs(_Fragment, {
|
|
220
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
221
|
+
children: "Flame chart is unavailable for queries longer than 15 minutes. Please select a point in the metrics graph to continue."
|
|
222
|
+
}), flamechartHelpText !== null && flamechartHelpText !== void 0 ? flamechartHelpText : null]
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
} else {
|
|
226
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
227
|
+
errorMessage: /*#__PURE__*/_jsxs(_Fragment, {
|
|
228
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
229
|
+
children: "The Flame chart is not available for this query."
|
|
230
|
+
}), flamechartHelpText !== null && flamechartHelpText !== void 0 ? flamechartHelpText : null]
|
|
231
|
+
})
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (arrow === undefined) return /*#__PURE__*/_jsx("div", {
|
|
236
|
+
className: "mx-auto text-center",
|
|
237
|
+
children: "No data..."
|
|
238
|
+
});
|
|
239
|
+
if (total === 0n && !loading) return /*#__PURE__*/_jsx("div", {
|
|
240
|
+
className: "mx-auto text-center",
|
|
241
|
+
children: "Profile has no samples"
|
|
59
242
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setIsLoading(false);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
setIsLoading(true);
|
|
98
|
-
}
|
|
99
|
-
}, [loadingState]);
|
|
100
|
-
const flameGraph = useMemo(() => {
|
|
101
|
-
const { isValid: isFlameChartValid, isNonDelta, isDurationTooLong, } = isFlameChart
|
|
102
|
-
? validateFlameChartQuery(profileSource)
|
|
103
|
-
: { isValid: true, isNonDelta: false, isDurationTooLong: false };
|
|
104
|
-
const isInvalidFlameChartQuery = isFlameChart && !isFlameChartValid;
|
|
105
|
-
if (isLoading && !isInvalidFlameChartQuery) {
|
|
106
|
-
return (_jsx("div", { className: "h-auto overflow-clip", "data-testid": TEST_IDS.FLAMEGRAPH_SKELETON, children: isRenderedAsFlamegraph ? (_jsx(SandwichFlameGraphSkeleton, { isHalfScreen: isHalfScreen, isDarkMode: isDarkMode })) : (_jsx(FlameGraphSkeleton, { isHalfScreen: isHalfScreen, isDarkMode: isDarkMode })) }));
|
|
107
|
-
}
|
|
108
|
-
// Do necessary checks to ensure that flame chart can be rendered for this query.
|
|
109
|
-
if (isInvalidFlameChartQuery) {
|
|
110
|
-
if (isNonDelta) {
|
|
111
|
-
return (_jsx(ErrorContent, { errorMessage: _jsxs(_Fragment, { children: [_jsx("span", { children: "To use the Flame chart, please switch to a Delta profile." }), flamechartHelpText ?? null] }) }));
|
|
112
|
-
}
|
|
113
|
-
else if (isDurationTooLong) {
|
|
114
|
-
return (_jsx(ErrorContent, { errorMessage: _jsxs(_Fragment, { children: [_jsx("span", { children: "Flame chart is unavailable for queries longer than 15 minutes. Please select a point in the metrics graph to continue." }), flamechartHelpText ?? null] }) }));
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return (_jsx(ErrorContent, { errorMessage: _jsxs(_Fragment, { children: [_jsx("span", { children: "The Flame chart is not available for this query." }), flamechartHelpText ?? null] }) }));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (arrow === undefined)
|
|
121
|
-
return _jsx("div", { className: "mx-auto text-center", children: "No data..." });
|
|
122
|
-
if (total === 0n && !loading)
|
|
123
|
-
return _jsx("div", { className: "mx-auto text-center", children: "Profile has no samples" });
|
|
124
|
-
if (arrow !== undefined) {
|
|
125
|
-
return (_jsx("div", { className: "relative", children: _jsx("div", { ref: flameChartRef, children: _jsx(FlameGraphArrow, { width: width, arrow: arrow, total: total, filtered: filtered, curPath: effectiveCurPathArrow, setCurPath: setCurPathArrowWrapper, profileType: profileType, isHalfScreen: isHalfScreen, mappingsListFromMetadata: mappingsList, filenamesListFromMetadata: filenamesList, compareAbsolute: isCompareAbsolute, isFlameChart: isFlameChart, profileSource: profileSource, isRenderedAsFlamegraph: isRenderedAsFlamegraph, isInSandwichView: isInSandwichView, tooltipId: tooltipId, maxFrameCount: maxFrameCount, isExpanded: isExpanded, colorBy: colorBy, zoomControlsRef: zoomControlsRef }) }) }));
|
|
126
|
-
}
|
|
127
|
-
}, [
|
|
128
|
-
isLoading,
|
|
129
|
-
arrow,
|
|
130
|
-
total,
|
|
131
|
-
loading,
|
|
132
|
-
width,
|
|
133
|
-
filtered,
|
|
134
|
-
profileType,
|
|
135
|
-
isHalfScreen,
|
|
136
|
-
isDarkMode,
|
|
137
|
-
isCompareAbsolute,
|
|
138
|
-
isFlameChart,
|
|
139
|
-
profileSource,
|
|
140
|
-
flameChartRef,
|
|
141
|
-
flamechartHelpText,
|
|
142
|
-
isRenderedAsFlamegraph,
|
|
143
|
-
isInSandwichView,
|
|
144
|
-
effectiveCurPathArrow,
|
|
145
|
-
setCurPathArrowWrapper,
|
|
146
|
-
tooltipId,
|
|
147
|
-
maxFrameCount,
|
|
148
|
-
isExpanded,
|
|
149
|
-
mappingsList,
|
|
150
|
-
filenamesList,
|
|
151
|
-
colorBy,
|
|
152
|
-
zoomControlsRef,
|
|
153
|
-
]);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
if (isTrimmed) {
|
|
156
|
-
console.info(`Trimmed ${trimmedFormatted} (${trimmedPercentage}%) too small values.`);
|
|
157
|
-
}
|
|
158
|
-
}, [isTrimmed, trimmedFormatted, trimmedPercentage]);
|
|
159
|
-
if (error != null) {
|
|
160
|
-
onError?.(error);
|
|
161
|
-
if (authenticationErrorMessage !== undefined && error.code === 'UNAUTHENTICATED') {
|
|
162
|
-
return _jsx(ErrorContent, { errorMessage: authenticationErrorMessage });
|
|
163
|
-
}
|
|
164
|
-
// Check for specific merge errors
|
|
165
|
-
const errorMessageLower = error.message?.toLowerCase() ?? '';
|
|
166
|
-
const isMergeError = errorMessageLower.includes('failed to merge flame chart records');
|
|
167
|
-
const isTimestampError = errorMessageLower.includes('multiple samples for the same timestamp is not allowed');
|
|
168
|
-
if (isMergeError || isTimestampError) {
|
|
169
|
-
return (_jsx(ErrorContent, { errorMessage: _jsxs(_Fragment, { children: [_jsx("span", { className: "font-semibold", children: "Unable to display overlapping data" }), _jsx("span", { className: "text-gray-600 dark:text-gray-400", children: "The selected data contains overlapping samples from multiple nodes or threads that cannot be merged." }), _jsx("span", { className: "text-gray-600 dark:text-gray-400", children: "To view this data, please apply more specific filters:" }), _jsxs("ul", { className: "list-disc list-inside text-left max-w-md mx-auto text-gray-600 dark:text-gray-400", children: [_jsx("li", { children: "Select a specific node from the node selector" }), _jsx("li", { children: "Filter by either CPU or thread" })] })] }) }));
|
|
170
|
-
}
|
|
171
|
-
return (_jsx(ErrorContent, { errorMessage: _jsxs(_Fragment, { children: [_jsx("span", { children: capitalizeOnlyFirstLetter(error.message) }), isFlameChart ? flamechartHelpText ?? null : null] }) }));
|
|
243
|
+
if (arrow !== undefined) {
|
|
244
|
+
return /*#__PURE__*/_jsx("div", {
|
|
245
|
+
className: "relative",
|
|
246
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
247
|
+
ref: flameChartRef,
|
|
248
|
+
children: /*#__PURE__*/_jsx(FlameGraphArrow, {
|
|
249
|
+
width: width,
|
|
250
|
+
arrow: arrow,
|
|
251
|
+
total: total,
|
|
252
|
+
filtered: filtered,
|
|
253
|
+
curPath: effectiveCurPathArrow,
|
|
254
|
+
setCurPath: setCurPathArrowWrapper,
|
|
255
|
+
profileType: profileType,
|
|
256
|
+
isHalfScreen: isHalfScreen,
|
|
257
|
+
mappingsListFromMetadata: mappingsList,
|
|
258
|
+
filenamesListFromMetadata: filenamesList,
|
|
259
|
+
compareAbsolute: isCompareAbsolute,
|
|
260
|
+
isFlameChart: isFlameChart,
|
|
261
|
+
profileSource: profileSource,
|
|
262
|
+
isRenderedAsFlamegraph: isRenderedAsFlamegraph,
|
|
263
|
+
isInSandwichView: isInSandwichView,
|
|
264
|
+
tooltipId: tooltipId,
|
|
265
|
+
maxFrameCount: maxFrameCount,
|
|
266
|
+
isExpanded: isExpanded,
|
|
267
|
+
colorBy: colorBy,
|
|
268
|
+
zoomControlsRef: zoomControlsRef
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}, [isLoading, arrow, total, loading, width, filtered, profileType, isHalfScreen, isDarkMode, isCompareAbsolute, isFlameChart, profileSource, flameChartRef, flamechartHelpText, isRenderedAsFlamegraph, isInSandwichView, effectiveCurPathArrow, setCurPathArrowWrapper, tooltipId, maxFrameCount, isExpanded, mappingsList, filenamesList, colorBy, zoomControlsRef]);
|
|
274
|
+
useEffect(function () {
|
|
275
|
+
if (isTrimmed) {
|
|
276
|
+
console.info("Trimmed ".concat(trimmedFormatted, " (").concat(trimmedPercentage, "%) too small values."));
|
|
172
277
|
}
|
|
173
|
-
|
|
278
|
+
}, [isTrimmed, trimmedFormatted, trimmedPercentage]);
|
|
279
|
+
if (error != null) {
|
|
280
|
+
var _error$message$toLowe, _error$message;
|
|
281
|
+
onError === null || onError === void 0 || onError(error);
|
|
282
|
+
if (authenticationErrorMessage !== undefined && error.code === 'UNAUTHENTICATED') {
|
|
283
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
284
|
+
errorMessage: authenticationErrorMessage
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Check for specific merge errors
|
|
289
|
+
var errorMessageLower = (_error$message$toLowe = (_error$message = error.message) === null || _error$message === void 0 ? void 0 : _error$message.toLowerCase()) !== null && _error$message$toLowe !== void 0 ? _error$message$toLowe : '';
|
|
290
|
+
var isMergeError = errorMessageLower.includes('failed to merge flame chart records');
|
|
291
|
+
var isTimestampError = errorMessageLower.includes('multiple samples for the same timestamp is not allowed');
|
|
292
|
+
if (isMergeError || isTimestampError) {
|
|
293
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
294
|
+
errorMessage: /*#__PURE__*/_jsxs(_Fragment, {
|
|
295
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
296
|
+
className: "font-semibold",
|
|
297
|
+
children: "Unable to display overlapping data"
|
|
298
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
299
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
300
|
+
children: "The selected data contains overlapping samples from multiple nodes or threads that cannot be merged."
|
|
301
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
302
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
303
|
+
children: "To view this data, please apply more specific filters:"
|
|
304
|
+
}), /*#__PURE__*/_jsxs("ul", {
|
|
305
|
+
className: "list-disc list-inside text-left max-w-md mx-auto text-gray-600 dark:text-gray-400",
|
|
306
|
+
children: [/*#__PURE__*/_jsx("li", {
|
|
307
|
+
children: "Select a specific node from the node selector"
|
|
308
|
+
}), /*#__PURE__*/_jsx("li", {
|
|
309
|
+
children: "Filter by either CPU or thread"
|
|
310
|
+
})]
|
|
311
|
+
})]
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
return /*#__PURE__*/_jsx(ErrorContent, {
|
|
316
|
+
errorMessage: /*#__PURE__*/_jsxs(_Fragment, {
|
|
317
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
318
|
+
children: capitalizeOnlyFirstLetter(error.message)
|
|
319
|
+
}), isFlameChart ? flamechartHelpText !== null && flamechartHelpText !== void 0 ? flamechartHelpText : null : null]
|
|
320
|
+
})
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return /*#__PURE__*/_jsx(AnimatePresence, {
|
|
324
|
+
children: /*#__PURE__*/_jsxs(motion.div, {
|
|
325
|
+
className: "relative h-full w-full",
|
|
326
|
+
initial: {
|
|
327
|
+
opacity: 0
|
|
328
|
+
},
|
|
329
|
+
animate: {
|
|
330
|
+
opacity: 1
|
|
331
|
+
},
|
|
332
|
+
transition: {
|
|
333
|
+
duration: 0.5
|
|
334
|
+
},
|
|
335
|
+
children: [compareMode ? /*#__PURE__*/_jsx(DiffLegend, {}) : null, /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
336
|
+
className: cx(!isInSandwichView ? 'min-h-48' : ''),
|
|
337
|
+
id: "h-flame-graph"
|
|
338
|
+
}, testId(TEST_IDS.FLAMEGRAPH_CONTAINER)), {}, {
|
|
339
|
+
children: /*#__PURE__*/_jsx(_Fragment, {
|
|
340
|
+
children: flameGraph
|
|
341
|
+
})
|
|
342
|
+
})), !isInSandwichView && /*#__PURE__*/_jsxs("p", {
|
|
343
|
+
className: "my-2 text-xs",
|
|
344
|
+
children: ["Showing ", totalFormatted, ' ', isFiltered ? /*#__PURE__*/_jsxs("span", {
|
|
345
|
+
children: ["(", filteredPercentage, "%) filtered of ", totalUnfilteredFormatted, ' ']
|
|
346
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {}), "values.", ' ']
|
|
347
|
+
})]
|
|
348
|
+
}, "flame-graph-loaded")
|
|
349
|
+
});
|
|
174
350
|
};
|
|
175
|
-
export default ProfileFlameGraph;
|
|
351
|
+
export default ProfileFlameGraph;
|