@perses-dev/flame-chart-plugin 0.2.0
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/LICENSE +201 -0
- package/README.md +23 -0
- package/__mf/css/async/325.f56729ca.css +1 -0
- package/__mf/css/async/341.f56729ca.css +1 -0
- package/__mf/css/async/908.f56729ca.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/FlameChart.96aae761.js +5 -0
- package/__mf/js/async/109.f7e97e30.js +73 -0
- package/__mf/js/async/109.f7e97e30.js.LICENSE.txt +35 -0
- package/__mf/js/async/173.40a64c5c.js +2 -0
- package/__mf/js/async/173.40a64c5c.js.LICENSE.txt +19 -0
- package/__mf/js/async/214.f491540e.js +1 -0
- package/__mf/js/async/224.511d05b6.js +1 -0
- package/__mf/js/async/238.5fdc556e.js +1 -0
- package/__mf/js/async/29.8b55315e.js +1 -0
- package/__mf/js/async/292.643bbcde.js +1 -0
- package/__mf/js/async/32.a46fc45f.js +110 -0
- package/__mf/js/async/32.a46fc45f.js.LICENSE.txt +49 -0
- package/__mf/js/async/325.80031d25.js +1 -0
- package/__mf/js/async/362.c587718a.js +1 -0
- package/__mf/js/async/409.fd2d437e.js +1 -0
- package/__mf/js/async/464.bb266d9b.js +7 -0
- package/__mf/js/async/464.bb266d9b.js.LICENSE.txt +21 -0
- package/__mf/js/async/488.807096d6.js +1 -0
- package/__mf/js/async/600.fdf527b8.js +38 -0
- package/__mf/js/async/651.9eb6f201.js +1 -0
- package/__mf/js/async/69.a1079bc1.js +2 -0
- package/__mf/js/async/69.a1079bc1.js.LICENSE.txt +24 -0
- package/__mf/js/async/694.15848123.js +1 -0
- package/__mf/js/async/738.0b2ab393.js +1 -0
- package/__mf/js/async/740.65aa69e2.js +1 -0
- package/__mf/js/async/75.3435fe3f.js +1 -0
- package/__mf/js/async/770.bc6ab5a3.js +1 -0
- package/__mf/js/async/863.8b7bdf43.js +2 -0
- package/__mf/js/async/863.8b7bdf43.js.LICENSE.txt +9 -0
- package/__mf/js/async/908.0672909d.js +1 -0
- package/__mf/js/async/960.d56a397e.js +2 -0
- package/__mf/js/async/960.d56a397e.js.LICENSE.txt +8 -0
- package/__mf/js/async/964.86d91e52.js +2 -0
- package/__mf/js/async/964.86d91e52.js.LICENSE.txt +9 -0
- package/__mf/js/async/981.4de2d5c8.js +2 -0
- package/__mf/js/async/981.4de2d5c8.js.LICENSE.txt +8 -0
- package/__mf/js/async/__federation_expose_FlameChart.aaa6df30.js +17 -0
- package/__mf/js/async/lib-router.00804bbc.js +2 -0
- package/__mf/js/async/lib-router.00804bbc.js.LICENSE.txt +32 -0
- package/__mf/js/main.4931a266.js +5 -0
- package/lib/FlameChart.d.ts +8 -0
- package/lib/FlameChart.d.ts.map +1 -0
- package/lib/FlameChart.js +32 -0
- package/lib/FlameChart.js.map +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/FlameChart.js +38 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/components/CustomBreadcrumb.js +96 -0
- package/lib/cjs/components/FlameChart.js +341 -0
- package/lib/cjs/components/FlameChartOptionsEditorSettings.js +87 -0
- package/lib/cjs/components/FlameChartPanel.js +147 -0
- package/lib/cjs/components/PaletteSelector.js +49 -0
- package/lib/cjs/components/SearchBar.js +59 -0
- package/lib/cjs/components/SeriesChart.js +189 -0
- package/lib/cjs/components/Settings.js +202 -0
- package/lib/cjs/components/SwitchSelector.js +37 -0
- package/lib/cjs/components/TableChart.js +143 -0
- package/lib/cjs/components/index.js +39 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/flame-chart-model.js +31 -0
- package/lib/cjs/getPluginModule.js +39 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/utils/data-model.js +18 -0
- package/lib/cjs/utils/data-transform.js +152 -0
- package/lib/cjs/utils/format.js +87 -0
- package/lib/cjs/utils/palette-gen.js +68 -0
- package/lib/cjs/utils/palette.js +62 -0
- package/lib/cjs/utils/series-tooltip.js +51 -0
- package/lib/cjs/utils/tooltip.js +76 -0
- package/lib/cjs/utils/ui-text.js +30 -0
- package/lib/cjs/utils/utils.js +108 -0
- package/lib/components/CustomBreadcrumb.d.ts +9 -0
- package/lib/components/CustomBreadcrumb.d.ts.map +1 -0
- package/lib/components/CustomBreadcrumb.js +83 -0
- package/lib/components/CustomBreadcrumb.js.map +1 -0
- package/lib/components/FlameChart.d.ts +13 -0
- package/lib/components/FlameChart.d.ts.map +1 -0
- package/lib/components/FlameChart.js +328 -0
- package/lib/components/FlameChart.js.map +1 -0
- package/lib/components/FlameChartOptionsEditorSettings.d.ts +4 -0
- package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -0
- package/lib/components/FlameChartOptionsEditorSettings.js +79 -0
- package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -0
- package/lib/components/FlameChartPanel.d.ts +7 -0
- package/lib/components/FlameChartPanel.d.ts.map +1 -0
- package/lib/components/FlameChartPanel.js +139 -0
- package/lib/components/FlameChartPanel.js.map +1 -0
- package/lib/components/PaletteSelector.d.ts +8 -0
- package/lib/components/PaletteSelector.d.ts.map +1 -0
- package/lib/components/PaletteSelector.js +41 -0
- package/lib/components/PaletteSelector.js.map +1 -0
- package/lib/components/SearchBar.d.ts +7 -0
- package/lib/components/SearchBar.d.ts.map +1 -0
- package/lib/components/SearchBar.js +46 -0
- package/lib/components/SearchBar.js.map +1 -0
- package/lib/components/SeriesChart.d.ts +9 -0
- package/lib/components/SeriesChart.d.ts.map +1 -0
- package/lib/components/SeriesChart.js +181 -0
- package/lib/components/SeriesChart.js.map +1 -0
- package/lib/components/Settings.d.ts +11 -0
- package/lib/components/Settings.d.ts.map +1 -0
- package/lib/components/Settings.js +189 -0
- package/lib/components/Settings.js.map +1 -0
- package/lib/components/SwitchSelector.d.ts +8 -0
- package/lib/components/SwitchSelector.d.ts.map +1 -0
- package/lib/components/SwitchSelector.js +29 -0
- package/lib/components/SwitchSelector.js.map +1 -0
- package/lib/components/TableChart.d.ts +12 -0
- package/lib/components/TableChart.d.ts.map +1 -0
- package/lib/components/TableChart.js +135 -0
- package/lib/components/TableChart.js.map +1 -0
- package/lib/components/index.d.ts +11 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +24 -0
- package/lib/components/index.js.map +1 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/flame-chart-model.d.ts +18 -0
- package/lib/flame-chart-model.d.ts.map +1 -0
- package/lib/flame-chart-model.js +23 -0
- package/lib/flame-chart-model.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +28 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/utils/data-model.d.ts +37 -0
- package/lib/utils/data-model.d.ts.map +1 -0
- package/lib/utils/data-model.js +19 -0
- package/lib/utils/data-model.js.map +1 -0
- package/lib/utils/data-transform.d.ts +19 -0
- package/lib/utils/data-transform.d.ts.map +1 -0
- package/lib/utils/data-transform.js +138 -0
- package/lib/utils/data-transform.js.map +1 -0
- package/lib/utils/format.d.ts +3 -0
- package/lib/utils/format.d.ts.map +1 -0
- package/lib/utils/format.js +71 -0
- package/lib/utils/format.js.map +1 -0
- package/lib/utils/palette-gen.d.ts +14 -0
- package/lib/utils/palette-gen.d.ts.map +1 -0
- package/lib/utils/palette-gen.js +56 -0
- package/lib/utils/palette-gen.js.map +1 -0
- package/lib/utils/palette.d.ts +5 -0
- package/lib/utils/palette.d.ts.map +1 -0
- package/lib/utils/palette.js +51 -0
- package/lib/utils/palette.js.map +1 -0
- package/lib/utils/series-tooltip.d.ts +3 -0
- package/lib/utils/series-tooltip.d.ts.map +1 -0
- package/lib/utils/series-tooltip.js +43 -0
- package/lib/utils/series-tooltip.js.map +1 -0
- package/lib/utils/tooltip.d.ts +6 -0
- package/lib/utils/tooltip.d.ts.map +1 -0
- package/lib/utils/tooltip.js +29 -0
- package/lib/utils/tooltip.js.map +1 -0
- package/lib/utils/ui-text.d.ts +9 -0
- package/lib/utils/ui-text.d.ts.map +1 -0
- package/lib/utils/ui-text.js +22 -0
- package/lib/utils/ui-text.js.map +1 -0
- package/lib/utils/utils.d.ts +36 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +92 -0
- package/lib/utils/utils.js.map +1 -0
- package/mf-manifest.json +274 -0
- package/mf-stats.json +322 -0
- package/package.json +64 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing | software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS |
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TableChart", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableChart;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _react = require("react");
|
|
25
|
+
const _material = require("@mui/material");
|
|
26
|
+
const _components = require("@perses-dev/components");
|
|
27
|
+
const _datatransform = require("../utils/data-transform");
|
|
28
|
+
const _format = require("../utils/format");
|
|
29
|
+
const _SearchBar = require("./SearchBar");
|
|
30
|
+
const LARGE_PANEL_TRESHOLD = 600; // heigth treshold to switch to large panel mode
|
|
31
|
+
const PADDING_TOP = 8;
|
|
32
|
+
const SCROLL_BAR_WIDTH = 15;
|
|
33
|
+
const SEARCH_BAR_HEIGHT = 50;
|
|
34
|
+
function TableChart(props) {
|
|
35
|
+
const { width, height, data, searchValue, onSearchValueChange, onSelectedIdChange } = props;
|
|
36
|
+
const theme = (0, _material.useTheme)();
|
|
37
|
+
const availableHeight = height;
|
|
38
|
+
const availableWidth = width - 10;
|
|
39
|
+
const tableData = (0, _react.useMemo)(()=>{
|
|
40
|
+
return (0, _datatransform.tableRecursionJson)(data.profile.stackTrace, searchValue);
|
|
41
|
+
}, [
|
|
42
|
+
data,
|
|
43
|
+
searchValue
|
|
44
|
+
]);
|
|
45
|
+
const columns = (0, _react.useMemo)(()=>{
|
|
46
|
+
const unit = data.metadata?.units || '';
|
|
47
|
+
const columnSettings = [
|
|
48
|
+
{
|
|
49
|
+
accessorKey: 'name',
|
|
50
|
+
header: 'Name',
|
|
51
|
+
headerDescription: 'Function name',
|
|
52
|
+
align: 'left',
|
|
53
|
+
enableSorting: true,
|
|
54
|
+
width: 0.5 * availableWidth,
|
|
55
|
+
cell: (ctx)=>{
|
|
56
|
+
const cellValue = ctx.getValue();
|
|
57
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Link, {
|
|
58
|
+
href: "#",
|
|
59
|
+
underline: "hover",
|
|
60
|
+
onClick: (e)=>{
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
const currentSample = ctx.row.original;
|
|
63
|
+
onSelectedIdChange(currentSample.id); // focus on this item in the flame graph
|
|
64
|
+
onSearchValueChange(currentSample.name);
|
|
65
|
+
},
|
|
66
|
+
children: cellValue
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
cellDescription: ()=>''
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
accessorKey: 'self',
|
|
73
|
+
header: 'Self',
|
|
74
|
+
headerDescription: 'Function self samples',
|
|
75
|
+
align: 'right',
|
|
76
|
+
enableSorting: true,
|
|
77
|
+
width: 0.25 * availableWidth - SCROLL_BAR_WIDTH,
|
|
78
|
+
cell: (ctx)=>{
|
|
79
|
+
const cellValue = ctx.getValue();
|
|
80
|
+
return (0, _format.formatItemValue)(unit, cellValue);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
accessorKey: 'total',
|
|
85
|
+
header: 'Total',
|
|
86
|
+
headerDescription: 'Function total samples',
|
|
87
|
+
align: 'right',
|
|
88
|
+
enableSorting: true,
|
|
89
|
+
width: 0.25 * availableWidth,
|
|
90
|
+
cell: (ctx)=>{
|
|
91
|
+
const cellValue = ctx.getValue();
|
|
92
|
+
return (0, _format.formatItemValue)(unit, cellValue);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
return columnSettings;
|
|
97
|
+
}, [
|
|
98
|
+
data.metadata?.units,
|
|
99
|
+
availableWidth,
|
|
100
|
+
onSearchValueChange,
|
|
101
|
+
onSelectedIdChange
|
|
102
|
+
]);
|
|
103
|
+
const [sorting, setSorting] = (0, _react.useState)([
|
|
104
|
+
{
|
|
105
|
+
id: 'total',
|
|
106
|
+
desc: true
|
|
107
|
+
}
|
|
108
|
+
]);
|
|
109
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
110
|
+
width: availableWidth,
|
|
111
|
+
height: availableHeight,
|
|
112
|
+
gap: 1,
|
|
113
|
+
sx: {
|
|
114
|
+
'& .MuiTable-root': {
|
|
115
|
+
borderCollapse: 'collapse'
|
|
116
|
+
},
|
|
117
|
+
'& .MuiTableCell-root': {
|
|
118
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
119
|
+
borderRight: `1px solid ${theme.palette.divider}`,
|
|
120
|
+
'&:last-child': {
|
|
121
|
+
borderRight: 'none'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_SearchBar.SearchBar, {
|
|
127
|
+
searchValue: searchValue,
|
|
128
|
+
onSearchValueChange: onSearchValueChange
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Table, {
|
|
131
|
+
data: tableData,
|
|
132
|
+
columns: columns,
|
|
133
|
+
height: availableHeight - PADDING_TOP - SEARCH_BAR_HEIGHT,
|
|
134
|
+
width: availableWidth,
|
|
135
|
+
density: availableHeight < LARGE_PANEL_TRESHOLD ? 'compact' : 'standard',
|
|
136
|
+
defaultColumnWidth: "auto",
|
|
137
|
+
defaultColumnHeight: "auto",
|
|
138
|
+
sorting: sorting,
|
|
139
|
+
onSortingChange: setSorting
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./CustomBreadcrumb"), exports);
|
|
18
|
+
_export_star(require("./FlameChart"), exports);
|
|
19
|
+
_export_star(require("./FlameChartOptionsEditorSettings"), exports);
|
|
20
|
+
_export_star(require("./FlameChartPanel"), exports);
|
|
21
|
+
_export_star(require("./PaletteSelector"), exports);
|
|
22
|
+
_export_star(require("./SearchBar"), exports);
|
|
23
|
+
_export_star(require("./SeriesChart"), exports);
|
|
24
|
+
_export_star(require("./Settings"), exports);
|
|
25
|
+
_export_star(require("./SwitchSelector"), exports);
|
|
26
|
+
_export_star(require("./TableChart"), exports);
|
|
27
|
+
function _export_star(from, to) {
|
|
28
|
+
Object.keys(from).forEach(function(k) {
|
|
29
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
30
|
+
Object.defineProperty(to, k, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return from[k];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return from;
|
|
39
|
+
}
|
package/lib/cjs/env.d.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
/// <reference types="@rsbuild/core/types" />
|
|
14
|
+
"use strict";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "createInitialFlameChartOptions", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return createInitialFlameChartOptions;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function createInitialFlameChartOptions() {
|
|
24
|
+
return {
|
|
25
|
+
palette: 'package-name',
|
|
26
|
+
showSettings: true,
|
|
27
|
+
showSeries: false,
|
|
28
|
+
showTable: true,
|
|
29
|
+
showFlameGraph: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getPluginModule", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return getPluginModule;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function getPluginModule() {
|
|
30
|
+
const { name, version, perses } = _packagejson.default;
|
|
31
|
+
return {
|
|
32
|
+
kind: 'PluginModule',
|
|
33
|
+
metadata: {
|
|
34
|
+
name,
|
|
35
|
+
version
|
|
36
|
+
},
|
|
37
|
+
spec: perses
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
15
|
+
if (typeof WeakMap !== "function") return null;
|
|
16
|
+
var cacheBabelInterop = new WeakMap();
|
|
17
|
+
var cacheNodeInterop = new WeakMap();
|
|
18
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
19
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
20
|
+
})(nodeInterop);
|
|
21
|
+
}
|
|
22
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
23
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
27
|
+
return {
|
|
28
|
+
default: obj
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
32
|
+
if (cache && cache.has(obj)) {
|
|
33
|
+
return cache.get(obj);
|
|
34
|
+
}
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
38
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
|
+
for(var key in obj){
|
|
40
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
41
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
42
|
+
if (desc && (desc.get || desc.set)) {
|
|
43
|
+
Object.defineProperty(newObj, key, desc);
|
|
44
|
+
} else {
|
|
45
|
+
newObj[key] = obj[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
newObj.default = obj;
|
|
50
|
+
if (cache) {
|
|
51
|
+
cache.set(obj, newObj);
|
|
52
|
+
}
|
|
53
|
+
return newObj;
|
|
54
|
+
}
|
|
55
|
+
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getPluginModule", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return _getPluginModule.getPluginModule;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
_export_star(require("./components"), exports);
|
|
24
|
+
const _getPluginModule = require("./getPluginModule");
|
|
25
|
+
function _export_star(from, to) {
|
|
26
|
+
Object.keys(from).forEach(function(k) {
|
|
27
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
28
|
+
Object.defineProperty(to, k, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function() {
|
|
31
|
+
return from[k];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return from;
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
require("@testing-library/jest-dom");
|
|
18
|
+
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
19
|
+
jest.mock('echarts/core');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
/**
|
|
14
|
+
* FlameChart datamodel
|
|
15
|
+
*/ "use strict";
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
filterJson: function() {
|
|
25
|
+
return filterJson;
|
|
26
|
+
},
|
|
27
|
+
findTotalSampleByName: function() {
|
|
28
|
+
return findTotalSampleByName;
|
|
29
|
+
},
|
|
30
|
+
recursionJson: function() {
|
|
31
|
+
return recursionJson;
|
|
32
|
+
},
|
|
33
|
+
tableRecursionJson: function() {
|
|
34
|
+
return tableRecursionJson;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _palettegen = require("./palette-gen");
|
|
38
|
+
const _format = require("./format");
|
|
39
|
+
function filterJson(json, id) {
|
|
40
|
+
if (id === null) {
|
|
41
|
+
return json;
|
|
42
|
+
}
|
|
43
|
+
const recur = (item, id)=>{
|
|
44
|
+
if (item.id === id) {
|
|
45
|
+
return item;
|
|
46
|
+
}
|
|
47
|
+
for (const child of item.children || []){
|
|
48
|
+
const temp = recur(child, id);
|
|
49
|
+
if (temp) {
|
|
50
|
+
item.children = [
|
|
51
|
+
temp
|
|
52
|
+
];
|
|
53
|
+
// change the parents' values
|
|
54
|
+
item.start = temp.start;
|
|
55
|
+
item.end = temp.end;
|
|
56
|
+
// item.self = temp.self;
|
|
57
|
+
// item.total = temp.total;
|
|
58
|
+
return item;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return recur(json, id) || json;
|
|
63
|
+
}
|
|
64
|
+
// build the name of the corresponding flamechart item
|
|
65
|
+
function formatName(item, rootVal, unit) {
|
|
66
|
+
return item.total / rootVal * 100 < 1 ? '' : item.name + ` (${(0, _format.formatItemValue)(unit, item.total)})`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Search the total value of an item corresponding to a given ID
|
|
70
|
+
*/ function getCurrentTotalValue(json, id) {
|
|
71
|
+
if (id === undefined) return 0;
|
|
72
|
+
const recur = (item)=>{
|
|
73
|
+
if (item.id === id) {
|
|
74
|
+
return item.total;
|
|
75
|
+
}
|
|
76
|
+
for (const child of item.children || []){
|
|
77
|
+
const total = recur(child);
|
|
78
|
+
if (total !== undefined) {
|
|
79
|
+
return total;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return 0; // If not found, return 0
|
|
83
|
+
};
|
|
84
|
+
return recur(json);
|
|
85
|
+
}
|
|
86
|
+
function recursionJson(palette, metadata, jsonObj, searchValue, id) {
|
|
87
|
+
const data = [];
|
|
88
|
+
const filteredJson = filterJson(structuredClone(jsonObj), id);
|
|
89
|
+
const rootVal = filteredJson.total; // total samples of root node
|
|
90
|
+
const currentVal = getCurrentTotalValue(filteredJson, id); // total samples of the selected item, used to generate items colors
|
|
91
|
+
const recur = (item)=>{
|
|
92
|
+
const temp = {
|
|
93
|
+
name: item.id,
|
|
94
|
+
value: [
|
|
95
|
+
item.level,
|
|
96
|
+
item.start,
|
|
97
|
+
item.end,
|
|
98
|
+
formatName(item, currentVal ? currentVal : rootVal, metadata?.units),
|
|
99
|
+
item.total / rootVal * 100,
|
|
100
|
+
item.self / rootVal * 100,
|
|
101
|
+
item.name,
|
|
102
|
+
item.self,
|
|
103
|
+
item.total
|
|
104
|
+
],
|
|
105
|
+
itemStyle: {
|
|
106
|
+
color: !isItemNameMatchesSearchFilters(item.name, searchValue) ? '#dee2e6' : (0, _palettegen.getSpanColor)(palette, item.name, item.total / (currentVal ? currentVal : rootVal) * 100)
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
data.push(temp);
|
|
110
|
+
for (const child of item.children || []){
|
|
111
|
+
recur(child);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
// check is filteredJson is not empty before call recur
|
|
115
|
+
if (filteredJson.id) recur(filteredJson);
|
|
116
|
+
return data;
|
|
117
|
+
}
|
|
118
|
+
function tableRecursionJson(jsonObj, searchValue) {
|
|
119
|
+
const data = [];
|
|
120
|
+
const structuredJson = structuredClone(jsonObj);
|
|
121
|
+
const recur = (item)=>{
|
|
122
|
+
const temp = {
|
|
123
|
+
id: item.id,
|
|
124
|
+
name: item.name,
|
|
125
|
+
self: item.self,
|
|
126
|
+
total: item.total
|
|
127
|
+
};
|
|
128
|
+
if (isItemNameMatchesSearchFilters(temp.name, searchValue)) data.push(temp);
|
|
129
|
+
for (const child of item.children || []){
|
|
130
|
+
recur(child);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
// check is structuredJson is not empty before call recur
|
|
134
|
+
if (structuredJson.id) recur(structuredJson);
|
|
135
|
+
return data;
|
|
136
|
+
}
|
|
137
|
+
// Checks if an item name matches all parts of a search value.
|
|
138
|
+
function isItemNameMatchesSearchFilters(itemName, searchValue) {
|
|
139
|
+
if (searchValue === '') return true;
|
|
140
|
+
const filters = searchValue.trim().toLocaleLowerCase().split(/[^a-zA-Z0-9']+/).filter((s)=>s !== '');
|
|
141
|
+
if (filters.length === 0) {
|
|
142
|
+
return false;
|
|
143
|
+
} else {
|
|
144
|
+
return filters.every((filter)=>itemName.toLowerCase().includes(filter.trim()));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function findTotalSampleByName(seriesData, name) {
|
|
148
|
+
if (name === undefined || name === 0) return undefined;
|
|
149
|
+
const item = seriesData.find((item)=>item.name === name);
|
|
150
|
+
const totalSample = item?.value[8];
|
|
151
|
+
return Number(totalSample);
|
|
152
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
formatItemValue: function() {
|
|
25
|
+
return formatItemValue;
|
|
26
|
+
},
|
|
27
|
+
formatNanoDuration: function() {
|
|
28
|
+
return formatNanoDuration;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const _core = require("@perses-dev/core");
|
|
32
|
+
function formatNanoDuration(value) {
|
|
33
|
+
// The value to format is in nanoseconds
|
|
34
|
+
if (value < 1_000) {
|
|
35
|
+
return (0, _core.formatValue)(value, {
|
|
36
|
+
unit: 'decimal',
|
|
37
|
+
decimalPlaces: 2,
|
|
38
|
+
shortValues: true
|
|
39
|
+
}) + 'ns';
|
|
40
|
+
} else if (value < 1_000_000) {
|
|
41
|
+
return (0, _core.formatValue)(value / 1_000, {
|
|
42
|
+
unit: 'decimal',
|
|
43
|
+
decimalPlaces: 2,
|
|
44
|
+
shortValues: true
|
|
45
|
+
}) + 'μs';
|
|
46
|
+
} else {
|
|
47
|
+
return (0, _core.formatDuration)((0, _core.msToPrometheusDuration)(value / 1_000_000));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function formatItemValue(unit, value) {
|
|
51
|
+
let valueWithUnit = '';
|
|
52
|
+
switch(unit){
|
|
53
|
+
case 'count':
|
|
54
|
+
valueWithUnit = (0, _core.formatValue)(value, {
|
|
55
|
+
unit: 'decimal',
|
|
56
|
+
decimalPlaces: 2,
|
|
57
|
+
shortValues: true
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
case 'samples':
|
|
61
|
+
valueWithUnit = (0, _core.formatValue)(value, {
|
|
62
|
+
unit: 'decimal',
|
|
63
|
+
decimalPlaces: 2,
|
|
64
|
+
shortValues: true
|
|
65
|
+
});
|
|
66
|
+
break;
|
|
67
|
+
case 'objects':
|
|
68
|
+
valueWithUnit = (0, _core.formatValue)(value, {
|
|
69
|
+
unit: 'decimal',
|
|
70
|
+
decimalPlaces: 2,
|
|
71
|
+
shortValues: true
|
|
72
|
+
});
|
|
73
|
+
break;
|
|
74
|
+
case 'bytes':
|
|
75
|
+
valueWithUnit = (0, _core.formatValue)(value, {
|
|
76
|
+
unit: 'bytes'
|
|
77
|
+
});
|
|
78
|
+
break;
|
|
79
|
+
case 'nanoseconds':
|
|
80
|
+
valueWithUnit = formatNanoDuration(value);
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
valueWithUnit = `${value} ${unit}`;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
return valueWithUnit;
|
|
87
|
+
}
|