@parca/profile 0.19.140 → 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 +5 -1
- 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.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
- 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.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
- 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.d.ts +2 -2
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/index.js +267 -129
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
- 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 +72 -47
- 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.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/index.js +324 -150
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/index.js +519 -258
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
- package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +727 -141
- 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.d.ts.map +1 -1
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
- package/dist/ProfileView/components/ColorStackLegend.js +185 -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.d.ts.map +1 -1
- package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
- 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.d.ts +2 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
- 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 +678 -194
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
- package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/index.js +212 -86
- 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.d.ts.map +1 -1
- package/dist/ProfileView/context/DashboardContext.js +85 -29
- 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.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
- 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.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +332 -228
- 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.d.ts.map +1 -1
- package/dist/Sandwich/index.js +126 -14
- 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.d.ts.map +1 -1
- package/dist/SourceView/index.js +178 -104
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
- package/dist/SourceView/useSelectedLineRange.js +99 -23
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.d.ts.map +1 -1
- package/dist/Table/MoreDropdown.js +122 -25
- package/dist/Table/TableContextMenu.d.ts.map +1 -1
- package/dist/Table/TableContextMenu.js +151 -137
- 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 +333 -169
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +222 -128
- 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.d.ts.map +1 -1
- package/dist/TopTable/index.js +342 -123
- 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.d.ts.map +1 -1
- package/dist/hooks/useCompareModeMeta.js +158 -64
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.d.ts +3 -3
- package/dist/hooks/useQueryState.d.ts.map +1 -1
- package/dist/hooks/useQueryState.js +373 -332
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -8
- 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 +1 -1
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -10
- package/src/GraphTooltipArrow/index.tsx +3 -0
- package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
- 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/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
- package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
- package/src/ProfileFlameChart/index.tsx +28 -21
- package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
- package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
- 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/ProfileFlameGraph/index.tsx +9 -6
- package/src/ProfileMetricsGraph/index.tsx +8 -6
- package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
- package/src/ProfileSelector/index.tsx +61 -39
- package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
- package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
- package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
- package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
- package/src/ProfileView/components/Toolbars/index.tsx +3 -3
- package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/ProfileView/context/DashboardContext.tsx +6 -6
- package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
- package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
- package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
- package/src/ProfileViewWithData.tsx +35 -29
- package/src/Sandwich/index.tsx +3 -4
- package/src/SourceView/index.tsx +2 -4
- package/src/SourceView/useSelectedLineRange.ts +19 -34
- package/src/Table/MoreDropdown.tsx +11 -9
- package/src/Table/TableContextMenu.tsx +13 -10
- package/src/Table/hooks/useTableConfiguration.tsx +11 -16
- package/src/Table/index.tsx +21 -12
- package/src/TopTable/index.tsx +4 -3
- package/src/hooks/useCompareModeMeta.ts +91 -61
- package/src/hooks/useQueryState.test.tsx +345 -275
- package/src/hooks/useQueryState.ts +118 -136
- package/src/index.tsx +15 -16
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +15 -21
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
- package/dist/hooks/urlParsers.d.ts +0 -18
- package/dist/hooks/urlParsers.d.ts.map +0 -1
- package/dist/hooks/urlParsers.js +0 -32
- package/dist/hooks/useColorBy.d.ts +0 -5
- package/dist/hooks/useColorBy.d.ts.map +0 -1
- package/dist/hooks/useColorBy.js +0 -26
- package/dist/hooks/useDashboardItems.d.ts +0 -5
- package/dist/hooks/useDashboardItems.d.ts.map +0 -1
- package/dist/hooks/useDashboardItems.js +0 -27
- package/dist/hooks/useQueryState.test.js +0 -868
- package/src/hooks/urlParsers.ts +0 -38
- package/src/hooks/useColorBy.ts +0 -42
- package/src/hooks/useDashboardItems.ts +0 -46
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
4
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
|
+
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; } }
|
|
7
|
+
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; }
|
|
1
8
|
// Copyright 2022 The Parca Authors
|
|
2
9
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
10
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,70 +17,122 @@
|
|
|
10
17
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
18
|
// See the License for the specific language governing permissions and
|
|
12
19
|
// limitations under the License.
|
|
20
|
+
|
|
13
21
|
// Determine which label keys have all-numeric values across every label set.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
var getNumericKeys = function getNumericKeys(labelSets) {
|
|
23
|
+
var numericKeys = new Set();
|
|
24
|
+
if (labelSets.length === 0) return numericKeys;
|
|
25
|
+
var keyCandidates = new Set(labelSets[0].labels.map(function (l) {
|
|
26
|
+
return l.name;
|
|
27
|
+
}));
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(keyCandidates),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
var _loop = function _loop() {
|
|
32
|
+
var key = _step.value;
|
|
33
|
+
var allNumeric = labelSets.every(function (ls) {
|
|
34
|
+
var label = ls.labels.find(function (l) {
|
|
35
|
+
return l.name === key;
|
|
23
36
|
});
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
return label != null && label.value !== '' && !isNaN(Number(label.value));
|
|
38
|
+
});
|
|
39
|
+
if (allNumeric) numericKeys.add(key);
|
|
40
|
+
};
|
|
41
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
42
|
+
_loop();
|
|
26
43
|
}
|
|
27
|
-
|
|
44
|
+
} catch (err) {
|
|
45
|
+
_iterator.e(err);
|
|
46
|
+
} finally {
|
|
47
|
+
_iterator.f();
|
|
48
|
+
}
|
|
49
|
+
return numericKeys;
|
|
28
50
|
};
|
|
51
|
+
|
|
29
52
|
// Get key order: text keys first (sorted), then numeric keys (sorted).
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
var getSortedKeys = function getSortedKeys(labelSets, numericKeys) {
|
|
54
|
+
var allKeys = new Set();
|
|
55
|
+
var _iterator2 = _createForOfIteratorHelper(labelSets),
|
|
56
|
+
_step2;
|
|
57
|
+
try {
|
|
58
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
59
|
+
var ls = _step2.value;
|
|
60
|
+
var _iterator3 = _createForOfIteratorHelper(ls.labels),
|
|
61
|
+
_step3;
|
|
62
|
+
try {
|
|
63
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
64
|
+
var l = _step3.value;
|
|
65
|
+
allKeys.add(l.name);
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_iterator3.e(err);
|
|
69
|
+
} finally {
|
|
70
|
+
_iterator3.f();
|
|
71
|
+
}
|
|
35
72
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
73
|
+
} catch (err) {
|
|
74
|
+
_iterator2.e(err);
|
|
75
|
+
} finally {
|
|
76
|
+
_iterator2.f();
|
|
77
|
+
}
|
|
78
|
+
return _toConsumableArray(allKeys).filter(function (k) {
|
|
79
|
+
return !numericKeys.has(k);
|
|
80
|
+
}).sort().concat(_toConsumableArray(numericKeys).sort());
|
|
40
81
|
};
|
|
82
|
+
|
|
41
83
|
// Format a LabelSet as a string with keys ordered: text first, then numeric.
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
84
|
+
export var labelSetToString = function labelSetToString(labelSet, keyOrder) {
|
|
85
|
+
if (labelSet === undefined) return '{}';
|
|
86
|
+
var labels = keyOrder != null ? keyOrder.map(function (key) {
|
|
87
|
+
return labelSet.labels.find(function (l) {
|
|
88
|
+
return l.name === key;
|
|
89
|
+
});
|
|
90
|
+
}).filter(function (l) {
|
|
91
|
+
return l != null;
|
|
92
|
+
}) : labelSet.labels;
|
|
93
|
+
if (labels.length === 0) return '{}';
|
|
94
|
+
return '{' + labels.map(function (l) {
|
|
95
|
+
return "".concat(l.name, ": ").concat(l.value);
|
|
96
|
+
}).join(', ') + '}';
|
|
53
97
|
};
|
|
98
|
+
|
|
54
99
|
// Build a comparator for LabelSets: text keys first (for grouping), then numeric keys.
|
|
55
100
|
// Also returns the key order so labelSetToString can use the same ordering.
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
101
|
+
export var createLabelSetComparator = function createLabelSetComparator(labelSets) {
|
|
102
|
+
var numericKeys = getNumericKeys(labelSets);
|
|
103
|
+
var keyOrder = getSortedKeys(labelSets, numericKeys);
|
|
104
|
+
var compare = function compare(a, b) {
|
|
105
|
+
var aMap = new Map(a.labels.map(function (l) {
|
|
106
|
+
return [l.name, l.value];
|
|
107
|
+
}));
|
|
108
|
+
var bMap = new Map(b.labels.map(function (l) {
|
|
109
|
+
return [l.name, l.value];
|
|
110
|
+
}));
|
|
111
|
+
var _iterator4 = _createForOfIteratorHelper(keyOrder),
|
|
112
|
+
_step4;
|
|
113
|
+
try {
|
|
114
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
115
|
+
var _aMap$get, _bMap$get;
|
|
116
|
+
var key = _step4.value;
|
|
117
|
+
var aVal = (_aMap$get = aMap.get(key)) !== null && _aMap$get !== void 0 ? _aMap$get : '';
|
|
118
|
+
var bVal = (_bMap$get = bMap.get(key)) !== null && _bMap$get !== void 0 ? _bMap$get : '';
|
|
119
|
+
if (numericKeys.has(key)) {
|
|
120
|
+
var diff = Number(aVal) - Number(bVal);
|
|
121
|
+
if (diff !== 0) return diff;
|
|
122
|
+
} else {
|
|
123
|
+
var cmp = aVal.localeCompare(bVal);
|
|
124
|
+
if (cmp !== 0) return cmp;
|
|
75
125
|
}
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
126
|
+
}
|
|
127
|
+
} catch (err) {
|
|
128
|
+
_iterator4.e(err);
|
|
129
|
+
} finally {
|
|
130
|
+
_iterator4.f();
|
|
131
|
+
}
|
|
132
|
+
return 0;
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
compare: compare,
|
|
136
|
+
keyOrder: keyOrder
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileFlameChart/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileFlameChart/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAoC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAQpF,OAAO,EAAwB,WAAW,EAAQ,MAAM,eAAe,CAAC;AAKxE,OAAO,EAAsB,aAAa,EAAa,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAC;AA4CpE,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC;AA+BD,eAAO,MAAM,iBAAiB,GAAI,kKAY/B,sBAAsB,KAAG,GAAG,CAAC,OAqM/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
10
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
11
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
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; } }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
2
18
|
// Copyright 2022 The Parca Authors
|
|
3
19
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
20
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,149 +27,271 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
27
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
28
|
// See the License for the specific language governing permissions and
|
|
13
29
|
// limitations under the License.
|
|
30
|
+
|
|
14
31
|
import { useEffect, useMemo, useRef } from 'react';
|
|
15
|
-
import { createParser, useQueryState } from 'nuqs';
|
|
16
32
|
import { QueryRequest_ReportType } from '@parca/client';
|
|
17
|
-
import { Button, useParcaContext } from '@parca/components';
|
|
33
|
+
import { Button, useParcaContext, useURLState, useURLStateCustom } from '@parca/components';
|
|
18
34
|
import { Matcher, MatcherTypes, Query } from '@parca/parser';
|
|
19
35
|
import { TimeUnits, formatDate, formatDuration } from '@parca/utilities';
|
|
20
36
|
import ProfileFlameGraph, { validateFlameChartQuery } from '../ProfileFlameGraph';
|
|
21
37
|
import { boundsFromProfileSource } from '../ProfileFlameGraph/FlameGraphArrow/utils';
|
|
22
38
|
import { MergedProfileSource, timeFormat } from '../ProfileSource';
|
|
23
39
|
import { useProfileFilters } from '../ProfileView/components/ProfileFilters/useProfileFilters';
|
|
24
|
-
import { flamechartDimensionParser } from '../hooks/urlParsers';
|
|
25
40
|
import { useQuery } from '../useQuery';
|
|
26
41
|
import { SamplesStrip } from './SamplesStrips';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
|
+
var TimeframeStateSerializer = {
|
|
44
|
+
parse: function parse(value) {
|
|
45
|
+
if (value == null || value === '' || value === 'undefined' || Array.isArray(value)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
var _value$split = value.split('|'),
|
|
50
|
+
_value$split2 = _slicedToArray(_value$split, 2),
|
|
51
|
+
labelPart = _value$split2[0],
|
|
52
|
+
boundsPart = _value$split2[1];
|
|
53
|
+
if (labelPart != null && boundsPart != null) {
|
|
54
|
+
var labels = labelPart.split(',').map(function (labelStr) {
|
|
55
|
+
var _labelStr$split = labelStr.split(':'),
|
|
56
|
+
_labelStr$split2 = _toArray(_labelStr$split),
|
|
57
|
+
name = _labelStr$split2[0],
|
|
58
|
+
rest = _arrayLikeToArray(_labelStr$split2).slice(1);
|
|
59
|
+
return {
|
|
60
|
+
name: name,
|
|
61
|
+
value: rest.join(':')
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
var _boundsPart$split$map = boundsPart.split(',').map(Number),
|
|
65
|
+
_boundsPart$split$map2 = _slicedToArray(_boundsPart$split$map, 2),
|
|
66
|
+
startMs = _boundsPart$split$map2[0],
|
|
67
|
+
endMs = _boundsPart$split$map2[1];
|
|
68
|
+
if (labels.length > 0 && !isNaN(startMs) && !isNaN(endMs)) {
|
|
69
|
+
return {
|
|
70
|
+
labels: {
|
|
71
|
+
labels: labels
|
|
72
|
+
},
|
|
73
|
+
bounds: [startMs, endMs]
|
|
74
|
+
};
|
|
47
75
|
}
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
}
|
|
77
|
+
} catch (_unused) {
|
|
78
|
+
// Ignore parsing errors
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
},
|
|
82
|
+
stringify: function stringify(value) {
|
|
83
|
+
if (value == null) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
var labelsStr = value.labels.labels.map(function (l) {
|
|
87
|
+
return "".concat(l.name, ":").concat(l.value);
|
|
88
|
+
}).join(',');
|
|
89
|
+
return "".concat(labelsStr, "|").concat(value.bounds[0], ",").concat(value.bounds[1]);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
55
92
|
// Helper to create a filtered profile source with narrowed time bounds
|
|
56
93
|
// and dimension label matchers from the selected strip.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
var createFilteredProfileSource = function createFilteredProfileSource(profileSource, selectedTimeframe) {
|
|
95
|
+
if (!(profileSource instanceof MergedProfileSource)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The bounds are in milliseconds, convert to nanoseconds for the profile source
|
|
100
|
+
// Round to integers since BigInt requires integer values
|
|
101
|
+
var mergeFrom = BigInt(Math.round(selectedTimeframe.bounds[0])) * 1000000n;
|
|
102
|
+
var mergeTo = BigInt(Math.round(selectedTimeframe.bounds[1])) * 1000000n;
|
|
103
|
+
|
|
104
|
+
// Add dimension labels as additional matchers to the query
|
|
105
|
+
var dimensionMatchers = selectedTimeframe.labels.labels.map(function (l) {
|
|
106
|
+
return new Matcher(l.name, MatcherTypes.MatchEqual, l.value);
|
|
107
|
+
});
|
|
108
|
+
var query = new Query(profileSource.query.profType, [].concat(_toConsumableArray(profileSource.query.matchers), _toConsumableArray(dimensionMatchers)), '');
|
|
109
|
+
return new MergedProfileSource(mergeFrom, mergeTo, query);
|
|
69
110
|
};
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
export var ProfileFlameChart = function ProfileFlameChart(_ref) {
|
|
112
|
+
var samplesData = _ref.samplesData,
|
|
113
|
+
queryClient = _ref.queryClient,
|
|
114
|
+
profileSource = _ref.profileSource,
|
|
115
|
+
width = _ref.width,
|
|
116
|
+
total = _ref.total,
|
|
117
|
+
filtered = _ref.filtered,
|
|
118
|
+
profileType = _ref.profileType,
|
|
119
|
+
isHalfScreen = _ref.isHalfScreen,
|
|
120
|
+
metadataMappingFiles = _ref.metadataMappingFiles,
|
|
121
|
+
metadataLoading = _ref.metadataLoading,
|
|
122
|
+
onSwitchToFifteenMinutes = _ref.onSwitchToFifteenMinutes;
|
|
123
|
+
var _useParcaContext = useParcaContext(),
|
|
124
|
+
enableFlamechartFiltering = _useParcaContext.enableFlamechartFiltering;
|
|
125
|
+
var _useProfileFilters = useProfileFilters(),
|
|
126
|
+
protoFilters = _useProfileFilters.protoFilters;
|
|
127
|
+
var zoomControlsRef = useRef(null);
|
|
128
|
+
var _useURLStateCustom = useURLStateCustom('flamechart_timeframe', TimeframeStateSerializer),
|
|
129
|
+
_useURLStateCustom2 = _slicedToArray(_useURLStateCustom, 2),
|
|
130
|
+
selectedTimeframe = _useURLStateCustom2[0],
|
|
131
|
+
setSelectedTimeframe = _useURLStateCustom2[1];
|
|
132
|
+
|
|
133
|
+
// Read flamechart dimension from URL state to detect changes
|
|
134
|
+
var _useURLState = useURLState('flamechart_dimension', {
|
|
135
|
+
alwaysReturnArray: true
|
|
136
|
+
}),
|
|
137
|
+
_useURLState2 = _slicedToArray(_useURLState, 1),
|
|
138
|
+
flamechartDimension = _useURLState2[0];
|
|
139
|
+
|
|
140
|
+
// Reset selection when the parent time range (profileSource) changes
|
|
141
|
+
var timeBoundsKey = boundsFromProfileSource(profileSource).join(',');
|
|
142
|
+
var prevTimeBoundsKey = useRef(timeBoundsKey);
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
if (prevTimeBoundsKey.current !== timeBoundsKey) {
|
|
145
|
+
prevTimeBoundsKey.current = timeBoundsKey;
|
|
146
|
+
setSelectedTimeframe(undefined);
|
|
147
|
+
}
|
|
148
|
+
}, [timeBoundsKey, setSelectedTimeframe]);
|
|
149
|
+
|
|
150
|
+
// Reset selection when the dimension changes
|
|
151
|
+
var dimensionKey = (flamechartDimension !== null && flamechartDimension !== void 0 ? flamechartDimension : []).join(',');
|
|
152
|
+
var prevDimensionKey = useRef(dimensionKey);
|
|
153
|
+
useEffect(function () {
|
|
154
|
+
if (prevDimensionKey.current !== dimensionKey) {
|
|
155
|
+
prevDimensionKey.current = dimensionKey;
|
|
156
|
+
setSelectedTimeframe(undefined);
|
|
157
|
+
}
|
|
158
|
+
}, [dimensionKey, setSelectedTimeframe]);
|
|
159
|
+
|
|
160
|
+
// Handle timeframe selection from strips
|
|
161
|
+
var handleSelectedTimeframe = function handleSelectedTimeframe(labels, bounds) {
|
|
162
|
+
if (bounds === undefined) {
|
|
163
|
+
setSelectedTimeframe(undefined);
|
|
164
|
+
} else {
|
|
165
|
+
setSelectedTimeframe({
|
|
166
|
+
labels: labels,
|
|
167
|
+
bounds: bounds
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Create filtered profile source when selection exists
|
|
173
|
+
var filteredProfileSource = useMemo(function () {
|
|
174
|
+
if (selectedTimeframe == null) return null;
|
|
175
|
+
return createFilteredProfileSource(profileSource, selectedTimeframe);
|
|
176
|
+
}, [profileSource, selectedTimeframe]);
|
|
177
|
+
|
|
178
|
+
// Query flamechart data only when a strip selection exists
|
|
179
|
+
var _useQuery = useQuery(queryClient, filteredProfileSource !== null && filteredProfileSource !== void 0 ? filteredProfileSource : profileSource, QueryRequest_ReportType.FLAMECHART, _objectSpread({
|
|
180
|
+
skip: selectedTimeframe == null || filteredProfileSource == null
|
|
181
|
+
}, enableFlamechartFiltering === true ? {
|
|
182
|
+
protoFilters: protoFilters
|
|
183
|
+
} : {})),
|
|
184
|
+
flamechartLoading = _useQuery.isLoading,
|
|
185
|
+
flamechartResponse = _useQuery.response,
|
|
186
|
+
flamechartError = _useQuery.error;
|
|
187
|
+
var flamechartArrow = (flamechartResponse === null || flamechartResponse === void 0 ? void 0 : flamechartResponse.report.oneofKind) === 'flamegraphArrow' ? flamechartResponse.report.flamegraphArrow : undefined;
|
|
188
|
+
var flamechartTotal = flamechartResponse != null ? BigInt(flamechartResponse.total) : total;
|
|
189
|
+
var flamechartFiltered = flamechartResponse != null ? BigInt(flamechartResponse.filtered) : filtered;
|
|
190
|
+
|
|
191
|
+
// Get time bounds from profile source for the strips
|
|
192
|
+
var timeBounds = boundsFromProfileSource(profileSource);
|
|
193
|
+
|
|
194
|
+
// Transform samples data for SamplesStrip component
|
|
195
|
+
var stripsData = useMemo(function () {
|
|
196
|
+
var _samplesData$stepMs;
|
|
197
|
+
if ((samplesData === null || samplesData === void 0 ? void 0 : samplesData.series) == null) return {
|
|
198
|
+
cpus: [],
|
|
199
|
+
data: [],
|
|
200
|
+
stepMs: 0
|
|
103
201
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (selectedTimeframe == null)
|
|
107
|
-
return null;
|
|
108
|
-
return createFilteredProfileSource(profileSource, selectedTimeframe);
|
|
109
|
-
}, [profileSource, selectedTimeframe]);
|
|
110
|
-
// Query flamechart data only when a strip selection exists
|
|
111
|
-
const { isLoading: flamechartLoading, response: flamechartResponse, error: flamechartError, } = useQuery(queryClient, filteredProfileSource ?? profileSource, QueryRequest_ReportType.FLAMECHART, {
|
|
112
|
-
skip: selectedTimeframe == null || filteredProfileSource == null,
|
|
113
|
-
...(enableFlamechartFiltering === true ? { protoFilters } : {}),
|
|
202
|
+
var cpus = samplesData.series.map(function (s) {
|
|
203
|
+
return s.labelset;
|
|
114
204
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const hasDimension = (flamechartDimension ?? []).length > 0;
|
|
142
|
-
const isStripsLoading = metadataLoading === true || !hasDimension || samplesData?.loading === true;
|
|
143
|
-
if (!hasDimension && metadataLoading !== true) {
|
|
144
|
-
return (_jsx("div", { className: "flex justify-center items-center py-10 text-gray-500 dark:text-gray-400 text-sm", children: "Select a label in the \"Samples group by\" dropdown above to view the samples strips." }));
|
|
205
|
+
var data = samplesData.series.map(function (s_0) {
|
|
206
|
+
return s_0.data;
|
|
207
|
+
});
|
|
208
|
+
var stepMs = (_samplesData$stepMs = samplesData.stepMs) !== null && _samplesData$stepMs !== void 0 ? _samplesData$stepMs : 0;
|
|
209
|
+
return {
|
|
210
|
+
cpus: cpus,
|
|
211
|
+
data: data,
|
|
212
|
+
stepMs: stepMs
|
|
213
|
+
};
|
|
214
|
+
}, [samplesData === null || samplesData === void 0 ? void 0 : samplesData.series, samplesData === null || samplesData === void 0 ? void 0 : samplesData.stepMs]);
|
|
215
|
+
var _validateFlameChartQu = validateFlameChartQuery(profileSource),
|
|
216
|
+
isValid = _validateFlameChartQu.isValid,
|
|
217
|
+
isNonDelta = _validateFlameChartQu.isNonDelta,
|
|
218
|
+
isDurationTooLong = _validateFlameChartQu.isDurationTooLong;
|
|
219
|
+
if (!isValid) {
|
|
220
|
+
if (isDurationTooLong) {
|
|
221
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
222
|
+
className: "flex flex-col justify-center items-center p-10 text-center gap-4 text-sm",
|
|
223
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
224
|
+
children: "Flame chart is unavailable for queries longer than 15 minutes. Try reducing the time range to 15 minutes or selecting a point in the metrics graph."
|
|
225
|
+
}), onSwitchToFifteenMinutes != null && /*#__PURE__*/_jsx(Button, {
|
|
226
|
+
variant: "primary",
|
|
227
|
+
onClick: onSwitchToFifteenMinutes,
|
|
228
|
+
children: "Switch to last 15 minutes"
|
|
229
|
+
})]
|
|
230
|
+
});
|
|
145
231
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
232
|
+
var message = isNonDelta ? 'To use the Flame chart, please switch to a Delta profile.' : 'Flame chart is unavailable for this query.';
|
|
233
|
+
return /*#__PURE__*/_jsx("div", {
|
|
234
|
+
className: "flex flex-col justify-center p-10 text-center gap-6 text-sm",
|
|
235
|
+
children: message
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
var hasDimension = (flamechartDimension !== null && flamechartDimension !== void 0 ? flamechartDimension : []).length > 0;
|
|
239
|
+
var isStripsLoading = metadataLoading === true || !hasDimension || (samplesData === null || samplesData === void 0 ? void 0 : samplesData.loading) === true;
|
|
240
|
+
if (!hasDimension && metadataLoading !== true) {
|
|
241
|
+
return /*#__PURE__*/_jsx("div", {
|
|
242
|
+
className: "flex justify-center items-center py-10 text-gray-500 dark:text-gray-400 text-sm",
|
|
243
|
+
children: "Select a label in the \"Samples group by\" dropdown above to view the samples strips."
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
247
|
+
children: [(isStripsLoading || stripsData.cpus.length > 0 && stripsData.data.length > 0) && /*#__PURE__*/_jsx("div", {
|
|
248
|
+
className: "mb-2",
|
|
249
|
+
children: /*#__PURE__*/_jsx(SamplesStrip, {
|
|
250
|
+
loading: isStripsLoading,
|
|
251
|
+
cpus: stripsData.cpus,
|
|
252
|
+
data: stripsData.data,
|
|
253
|
+
selectedTimeframe: selectedTimeframe,
|
|
254
|
+
onSelectedTimeframe: handleSelectedTimeframe,
|
|
255
|
+
width: width,
|
|
256
|
+
bounds: [Number(timeBounds[0] / 1000000n), Number(timeBounds[1] / 1000000n)],
|
|
257
|
+
stepMs: stripsData.stepMs
|
|
258
|
+
})
|
|
259
|
+
}), selectedTimeframe != null && function () {
|
|
260
|
+
var labels_0 = selectedTimeframe.labels.labels.map(function (l) {
|
|
261
|
+
return "".concat(l.name, " = ").concat(l.value);
|
|
262
|
+
}).join(', ');
|
|
263
|
+
var durationMs = selectedTimeframe.bounds[1] - selectedTimeframe.bounds[0];
|
|
264
|
+
var duration = durationMs < 5000 ? "".concat((durationMs / 1000).toFixed(1), "s") : formatDuration(_defineProperty({}, TimeUnits.Milliseconds, durationMs));
|
|
265
|
+
var fmt = durationMs < 5000 ? "yyyy-MM-dd HH:mm:ss.SSS '(UTC)'" : timeFormat();
|
|
266
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
267
|
+
className: "flex items-center justify-between px-2 py-1",
|
|
268
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
269
|
+
className: "text-xs font-medium text-gray-500 dark:text-gray-400",
|
|
270
|
+
children: ["Samples matching ", labels_0, " over ", duration, " from", ' ', formatDate(new Date(selectedTimeframe.bounds[0]), fmt), " to", ' ', formatDate(new Date(selectedTimeframe.bounds[1]), fmt)]
|
|
271
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
272
|
+
ref: zoomControlsRef
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
275
|
+
}(), selectedTimeframe != null && filteredProfileSource != null ? /*#__PURE__*/_jsx(ProfileFlameGraph, {
|
|
276
|
+
arrow: flamechartArrow,
|
|
277
|
+
loading: flamechartLoading,
|
|
278
|
+
error: flamechartError,
|
|
279
|
+
profileSource: filteredProfileSource,
|
|
280
|
+
width: width,
|
|
281
|
+
total: flamechartTotal,
|
|
282
|
+
filtered: flamechartFiltered,
|
|
283
|
+
profileType: profileType,
|
|
284
|
+
isHalfScreen: isHalfScreen,
|
|
285
|
+
metadataMappingFiles: metadataMappingFiles,
|
|
286
|
+
metadataLoading: metadataLoading,
|
|
287
|
+
isFlameChart: true,
|
|
288
|
+
curPathArrow: [],
|
|
289
|
+
setNewCurPathArrow: function setNewCurPathArrow() {},
|
|
290
|
+
zoomControlsRef: zoomControlsRef
|
|
291
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
292
|
+
className: "flex justify-center items-center py-10 text-gray-500 dark:text-gray-400 text-sm",
|
|
293
|
+
children: "Select a time range in the samples strips above to view the flamechart."
|
|
294
|
+
})]
|
|
295
|
+
});
|
|
158
296
|
};
|
|
159
|
-
export default ProfileFlameChart;
|
|
297
|
+
export default ProfileFlameChart;
|