@perses-dev/flame-chart-plugin 0.6.0 → 0.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/__mf/js/{FlameChart.8940202b.js → FlameChart.75e60eeb.js} +7 -7
  2. package/__mf/js/async/121.b114caf4.js +2 -0
  3. package/__mf/js/async/168.6611ee4e.js +1 -0
  4. package/__mf/js/async/183.92eba0e3.js +2 -0
  5. package/__mf/js/async/192.8ce3d05c.js +1 -0
  6. package/__mf/js/async/2.9b63234c.js +1 -0
  7. package/__mf/js/async/235.b209897c.js +1 -0
  8. package/__mf/js/async/274.e53c6dc1.js +2 -0
  9. package/__mf/js/async/354.12841635.js +4 -0
  10. package/__mf/js/async/354.12841635.js.LICENSE.txt +9 -0
  11. package/__mf/js/async/356.8389aa5c.js +1 -0
  12. package/__mf/js/async/392.800bb82c.js +2 -0
  13. package/__mf/js/async/40.8889cead.js +43 -0
  14. package/__mf/js/async/{657.9473a80f.js.LICENSE.txt → 40.8889cead.js.LICENSE.txt} +41 -1
  15. package/__mf/js/async/43.71599a15.js +2 -0
  16. package/__mf/js/async/464.b8482365.js +1 -0
  17. package/__mf/js/async/470.1af0a163.js +2 -0
  18. package/__mf/js/async/587.2887e89e.js +1 -0
  19. package/__mf/js/async/616.d35b2918.js +1 -0
  20. package/__mf/js/async/663.d6e01d16.js +1 -0
  21. package/__mf/js/async/787.a8f426c4.js +1 -0
  22. package/__mf/js/async/802.f2161316.js +110 -0
  23. package/__mf/js/async/867.d3758c62.js +1 -0
  24. package/__mf/js/async/873.fd0c9e57.js +1 -0
  25. package/__mf/js/async/941.e44ab19f.js +2 -0
  26. package/__mf/js/async/968.5e8d690f.js +1 -0
  27. package/__mf/js/async/__federation_expose_FlameChart.668f250d.js +17 -0
  28. package/__mf/js/async/lib-router.d7bf8c32.js +2 -0
  29. package/__mf/js/{main.08e04feb.js → main.0d13937b.js} +3 -3
  30. package/lib/FlameChart.d.ts +3 -3
  31. package/lib/FlameChart.d.ts.map +1 -1
  32. package/lib/FlameChart.js +2 -2
  33. package/lib/FlameChart.js.map +1 -1
  34. package/lib/bootstrap.js +2 -2
  35. package/lib/components/CustomBreadcrumb.d.ts +1 -1
  36. package/lib/components/CustomBreadcrumb.d.ts.map +1 -1
  37. package/lib/components/CustomBreadcrumb.js +8 -8
  38. package/lib/components/CustomBreadcrumb.js.map +1 -1
  39. package/lib/components/FlameChart.d.ts +2 -2
  40. package/lib/components/FlameChart.d.ts.map +1 -1
  41. package/lib/components/FlameChart.js +10 -10
  42. package/lib/components/FlameChart.js.map +1 -1
  43. package/lib/components/FlameChartOptionsEditorSettings.d.ts +2 -2
  44. package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -1
  45. package/lib/components/FlameChartOptionsEditorSettings.js +6 -6
  46. package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -1
  47. package/lib/components/FlameChartPanel.d.ts +4 -4
  48. package/lib/components/FlameChartPanel.d.ts.map +1 -1
  49. package/lib/components/FlameChartPanel.js +88 -71
  50. package/lib/components/FlameChartPanel.js.map +1 -1
  51. package/lib/components/PaletteSelector.d.ts +1 -1
  52. package/lib/components/PaletteSelector.d.ts.map +1 -1
  53. package/lib/components/PaletteSelector.js +2 -2
  54. package/lib/components/PaletteSelector.js.map +1 -1
  55. package/lib/components/SearchBar.d.ts +1 -1
  56. package/lib/components/SearchBar.d.ts.map +1 -1
  57. package/lib/components/SearchBar.js +3 -3
  58. package/lib/components/SearchBar.js.map +1 -1
  59. package/lib/components/SeriesChart.d.ts +2 -2
  60. package/lib/components/SeriesChart.d.ts.map +1 -1
  61. package/lib/components/SeriesChart.js +6 -6
  62. package/lib/components/SeriesChart.js.map +1 -1
  63. package/lib/components/Settings.d.ts +2 -2
  64. package/lib/components/Settings.d.ts.map +1 -1
  65. package/lib/components/Settings.js +6 -6
  66. package/lib/components/Settings.js.map +1 -1
  67. package/lib/components/SwitchSelector.d.ts +1 -1
  68. package/lib/components/SwitchSelector.d.ts.map +1 -1
  69. package/lib/components/SwitchSelector.js +3 -3
  70. package/lib/components/SwitchSelector.js.map +1 -1
  71. package/lib/components/TableChart.d.ts +2 -2
  72. package/lib/components/TableChart.d.ts.map +1 -1
  73. package/lib/components/TableChart.js +6 -6
  74. package/lib/components/TableChart.js.map +1 -1
  75. package/lib/components/index.js +10 -10
  76. package/lib/components/index.js.map +1 -1
  77. package/lib/flame-chart-model.d.ts +2 -2
  78. package/lib/flame-chart-model.d.ts.map +1 -1
  79. package/lib/flame-chart-model.js.map +1 -1
  80. package/lib/getPluginModule.d.ts +1 -1
  81. package/lib/getPluginModule.d.ts.map +1 -1
  82. package/lib/getPluginModule.js +3 -1
  83. package/lib/getPluginModule.js.map +1 -1
  84. package/lib/index-federation.js +1 -1
  85. package/lib/index.js +2 -2
  86. package/lib/index.js.map +1 -1
  87. package/lib/setup-tests.d.ts +1 -1
  88. package/lib/setup-tests.d.ts.map +1 -1
  89. package/lib/setup-tests.js +2 -2
  90. package/lib/setup-tests.js.map +1 -1
  91. package/lib/utils/data-transform.d.ts +2 -2
  92. package/lib/utils/data-transform.d.ts.map +1 -1
  93. package/lib/utils/data-transform.js +2 -2
  94. package/lib/utils/data-transform.js.map +1 -1
  95. package/lib/utils/format.js +2 -2
  96. package/lib/utils/palette-gen.js +1 -1
  97. package/lib/utils/palette-gen.js.map +1 -1
  98. package/lib/utils/palette.js +1 -1
  99. package/lib/utils/series-tooltip.d.ts +1 -1
  100. package/lib/utils/series-tooltip.d.ts.map +1 -1
  101. package/lib/utils/series-tooltip.js +1 -1
  102. package/lib/utils/series-tooltip.js.map +1 -1
  103. package/lib/utils/tooltip.d.ts +1 -1
  104. package/lib/utils/tooltip.d.ts.map +1 -1
  105. package/lib/utils/tooltip.js +2 -2
  106. package/lib/utils/tooltip.js.map +1 -1
  107. package/lib/utils/utils.d.ts +2 -2
  108. package/lib/utils/utils.d.ts.map +1 -1
  109. package/lib/utils/utils.js +1 -1
  110. package/lib/utils/utils.js.map +1 -1
  111. package/mf-manifest.json +31 -53
  112. package/mf-stats.json +31 -57
  113. package/package.json +10 -10
  114. package/__mf/js/async/121.7241788e.js +0 -2
  115. package/__mf/js/async/177.d1b72566.js +0 -1
  116. package/__mf/js/async/187.d2c3954d.js +0 -7
  117. package/__mf/js/async/187.d2c3954d.js.LICENSE.txt +0 -39
  118. package/__mf/js/async/192.2e230dc2.js +0 -1
  119. package/__mf/js/async/2.3d2f3d32.js +0 -1
  120. package/__mf/js/async/235.f7949644.js +0 -1
  121. package/__mf/js/async/274.f1ae4a6c.js +0 -2
  122. package/__mf/js/async/356.941c6c54.js +0 -1
  123. package/__mf/js/async/367.8beb758e.js +0 -110
  124. package/__mf/js/async/392.157fda9a.js +0 -2
  125. package/__mf/js/async/43.2eeeac07.js +0 -2
  126. package/__mf/js/async/470.55030a0b.js +0 -2
  127. package/__mf/js/async/546.d47a49c6.js +0 -24
  128. package/__mf/js/async/546.d47a49c6.js.LICENSE.txt +0 -19
  129. package/__mf/js/async/587.8bcd9e70.js +0 -1
  130. package/__mf/js/async/588.0012e8ae.js +0 -1
  131. package/__mf/js/async/597.fee7f09c.js +0 -1
  132. package/__mf/js/async/616.da14f6a0.js +0 -1
  133. package/__mf/js/async/657.9473a80f.js +0 -39
  134. package/__mf/js/async/698.06b3786e.js +0 -1
  135. package/__mf/js/async/71.126af909.js +0 -1
  136. package/__mf/js/async/740.c1f5cc4b.js +0 -1
  137. package/__mf/js/async/873.cd4654cd.js +0 -1
  138. package/__mf/js/async/941.c00ae16d.js +0 -2
  139. package/__mf/js/async/968.f7510839.js +0 -1
  140. package/__mf/js/async/97.fd587361.js +0 -1
  141. package/__mf/js/async/978.e1b5b66e.js +0 -1
  142. package/__mf/js/async/__federation_expose_FlameChart.7a8d049a.js +0 -17
  143. package/__mf/js/async/lib-router.1a328ab9.js +0 -2
  144. package/lib/cjs/FlameChart.js +0 -37
  145. package/lib/cjs/bootstrap.js +0 -26
  146. package/lib/cjs/components/CustomBreadcrumb.js +0 -96
  147. package/lib/cjs/components/FlameChart.js +0 -341
  148. package/lib/cjs/components/FlameChartOptionsEditorSettings.js +0 -104
  149. package/lib/cjs/components/FlameChartPanel.js +0 -164
  150. package/lib/cjs/components/PaletteSelector.js +0 -49
  151. package/lib/cjs/components/SearchBar.js +0 -59
  152. package/lib/cjs/components/SeriesChart.js +0 -189
  153. package/lib/cjs/components/Settings.js +0 -202
  154. package/lib/cjs/components/SwitchSelector.js +0 -37
  155. package/lib/cjs/components/TableChart.js +0 -143
  156. package/lib/cjs/components/index.js +0 -39
  157. package/lib/cjs/env.d.js +0 -14
  158. package/lib/cjs/flame-chart-model.js +0 -31
  159. package/lib/cjs/getPluginModule.js +0 -39
  160. package/lib/cjs/index-federation.js +0 -55
  161. package/lib/cjs/index.js +0 -37
  162. package/lib/cjs/setup-tests.js +0 -19
  163. package/lib/cjs/utils/data-model.js +0 -18
  164. package/lib/cjs/utils/data-transform.js +0 -163
  165. package/lib/cjs/utils/format.js +0 -88
  166. package/lib/cjs/utils/palette-gen.js +0 -68
  167. package/lib/cjs/utils/palette.js +0 -62
  168. package/lib/cjs/utils/series-tooltip.js +0 -51
  169. package/lib/cjs/utils/tooltip.js +0 -76
  170. package/lib/cjs/utils/ui-text.js +0 -30
  171. package/lib/cjs/utils/utils.js +0 -122
  172. /package/__mf/css/async/{187.85c2cbf6.css → 40.85c2cbf6.css} +0 -0
  173. /package/__mf/js/async/{121.7241788e.js.LICENSE.txt → 121.b114caf4.js.LICENSE.txt} +0 -0
  174. /package/__mf/js/async/{274.f1ae4a6c.js.LICENSE.txt → 274.e53c6dc1.js.LICENSE.txt} +0 -0
  175. /package/__mf/js/async/{392.157fda9a.js.LICENSE.txt → 392.800bb82c.js.LICENSE.txt} +0 -0
  176. /package/__mf/js/async/{43.2eeeac07.js.LICENSE.txt → 43.71599a15.js.LICENSE.txt} +0 -0
  177. /package/__mf/js/async/{470.55030a0b.js.LICENSE.txt → 470.1af0a163.js.LICENSE.txt} +0 -0
  178. /package/__mf/js/async/{367.8beb758e.js.LICENSE.txt → 802.f2161316.js.LICENSE.txt} +0 -0
  179. /package/__mf/js/async/{941.c00ae16d.js.LICENSE.txt → 941.e44ab19f.js.LICENSE.txt} +0 -0
  180. /package/__mf/js/async/{lib-router.1a328ab9.js.LICENSE.txt → lib-router.d7bf8c32.js.LICENSE.txt} +0 -0
@@ -1,31 +0,0 @@
1
- // Copyright 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
- }
@@ -1,39 +0,0 @@
1
- // Copyright 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
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- function _getRequireWildcardCache(nodeInterop) {
3
- if (typeof WeakMap !== "function") return null;
4
- var cacheBabelInterop = new WeakMap();
5
- var cacheNodeInterop = new WeakMap();
6
- return (_getRequireWildcardCache = function(nodeInterop) {
7
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
8
- })(nodeInterop);
9
- }
10
- function _interop_require_wildcard(obj, nodeInterop) {
11
- if (!nodeInterop && obj && obj.__esModule) {
12
- return obj;
13
- }
14
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
15
- return {
16
- default: obj
17
- };
18
- }
19
- var cache = _getRequireWildcardCache(nodeInterop);
20
- if (cache && cache.has(obj)) {
21
- return cache.get(obj);
22
- }
23
- var newObj = {
24
- __proto__: null
25
- };
26
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
27
- for(var key in obj){
28
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
30
- if (desc && (desc.get || desc.set)) {
31
- Object.defineProperty(newObj, key, desc);
32
- } else {
33
- newObj[key] = obj[key];
34
- }
35
- }
36
- }
37
- newObj.default = obj;
38
- if (cache) {
39
- cache.set(obj, newObj);
40
- }
41
- return newObj;
42
- }
43
- // Copyright The Perses Authors
44
- // Licensed under the Apache License, Version 2.0 (the "License");
45
- // you may not use this file except in compliance with the License.
46
- // You may obtain a copy of the License at
47
- //
48
- // http://www.apache.org/licenses/LICENSE-2.0
49
- //
50
- // Unless required by applicable law or agreed to in writing, software
51
- // distributed under the License is distributed on an "AS IS" BASIS,
52
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
- // See the License for the specific language governing permissions and
54
- // limitations under the License.
55
- Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
package/lib/cjs/index.js DELETED
@@ -1,37 +0,0 @@
1
- // Copyright 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
- }
@@ -1,19 +0,0 @@
1
- // Copyright 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');
@@ -1,18 +0,0 @@
1
- // Copyright 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
- });
@@ -1,163 +0,0 @@
1
- // Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get buildSamples () {
25
- return buildSamples;
26
- },
27
- get filterStackTraceById () {
28
- return filterStackTraceById;
29
- },
30
- get findTotalSampleByName () {
31
- return findTotalSampleByName;
32
- },
33
- get getMaxDepth () {
34
- return getMaxDepth;
35
- },
36
- get tableRecursionJson () {
37
- return tableRecursionJson;
38
- }
39
- });
40
- const _palettegen = require("./palette-gen");
41
- const _format = require("./format");
42
- function filterStackTraceById(trace, id) {
43
- if (id === undefined) {
44
- return trace;
45
- }
46
- const recur = (trace, id)=>{
47
- if (trace.id === id) {
48
- return trace;
49
- }
50
- for (const child of trace.children ?? []){
51
- const temp = recur(child, id);
52
- if (temp) {
53
- trace = {
54
- ...trace
55
- }; // Create a shallow copy of the trace to avoid mutating the original object
56
- // Override parents' values
57
- trace.children = [
58
- temp
59
- ];
60
- trace.start = temp.start;
61
- trace.end = temp.end;
62
- return trace;
63
- }
64
- }
65
- return undefined;
66
- };
67
- return recur(trace, id) ?? trace;
68
- }
69
- // build the name of the corresponding flamechart item
70
- function formatName(item, rootVal, unit) {
71
- return item.total / rootVal * 100 < 1 ? '' : item.name + ` (${(0, _format.formatItemValue)(unit, item.total)})`;
72
- }
73
- /**
74
- * Search the total value of an item corresponding to a given ID
75
- */ function getCurrentTotalValue(json, id) {
76
- if (id === undefined) return 0;
77
- const recur = (item)=>{
78
- if (item.id === id) {
79
- return item.total;
80
- }
81
- for (const child of item.children || []){
82
- const total = recur(child);
83
- if (total !== undefined) {
84
- return total;
85
- }
86
- }
87
- return 0; // If not found, return 0
88
- };
89
- return recur(json);
90
- }
91
- function buildSamples(palette, metadata, traces, searchValue, id) {
92
- const data = [];
93
- const filteredJson = filterStackTraceById(traces, id);
94
- const rootVal = filteredJson.total; // total samples of root node
95
- const currentVal = getCurrentTotalValue(filteredJson, id); // total samples of the selected item, used to generate items colors
96
- const recur = (item)=>{
97
- const temp = {
98
- name: item.id,
99
- value: [
100
- item.level,
101
- item.start,
102
- item.end,
103
- formatName(item, currentVal ? currentVal : rootVal, metadata?.units),
104
- item.total / rootVal * 100,
105
- item.self / rootVal * 100,
106
- item.name,
107
- item.self,
108
- item.total
109
- ],
110
- itemStyle: {
111
- color: !isItemNameMatchesSearchFilters(item.name, searchValue) ? '#dee2e6' : (0, _palettegen.getSpanColor)(palette, item.name, item.total / (currentVal ? currentVal : rootVal) * 100)
112
- }
113
- };
114
- data.push(temp);
115
- for (const child of item.children || []){
116
- recur(child);
117
- }
118
- };
119
- // check is filteredJson is not empty before call recur
120
- if (filteredJson.id) recur(filteredJson);
121
- return data;
122
- }
123
- function tableRecursionJson(jsonObj, searchValue) {
124
- const data = [];
125
- const structuredJson = structuredClone(jsonObj);
126
- const recur = (item)=>{
127
- const temp = {
128
- id: item.id,
129
- name: item.name,
130
- self: item.self,
131
- total: item.total
132
- };
133
- if (isItemNameMatchesSearchFilters(temp.name, searchValue)) data.push(temp);
134
- for (const child of item.children || []){
135
- recur(child);
136
- }
137
- };
138
- // check is structuredJson is not empty before call recur
139
- if (structuredJson.id) recur(structuredJson);
140
- return data;
141
- }
142
- // Checks if an item name matches all parts of a search value.
143
- function isItemNameMatchesSearchFilters(itemName, searchValue) {
144
- if (searchValue === '') return true;
145
- const filters = searchValue.trim().toLocaleLowerCase().split(/[^a-zA-Z0-9']+/).filter((s)=>s !== '');
146
- if (filters.length === 0) {
147
- return false;
148
- } else {
149
- return filters.every((filter)=>itemName.toLowerCase().includes(filter.trim()));
150
- }
151
- }
152
- function findTotalSampleByName(seriesData, name) {
153
- if (name === undefined || name === 0) return undefined;
154
- const item = seriesData.find((item)=>item.name === name);
155
- const totalSample = item?.value[8];
156
- return Number(totalSample);
157
- }
158
- function getMaxDepth(trace) {
159
- if (!trace.children?.length) {
160
- return 1;
161
- }
162
- return 1 + Math.max(...trace.children.map(getMaxDepth));
163
- }
@@ -1,88 +0,0 @@
1
- // Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get formatItemValue () {
25
- return formatItemValue;
26
- },
27
- get formatNanoDuration () {
28
- return formatNanoDuration;
29
- }
30
- });
31
- const _components = require("@perses-dev/components");
32
- const _spec = require("@perses-dev/spec");
33
- function formatNanoDuration(value) {
34
- // The value to format is in nanoseconds
35
- if (value < 1_000) {
36
- return (0, _components.formatValue)(value, {
37
- unit: 'decimal',
38
- decimalPlaces: 2,
39
- shortValues: true
40
- }) + 'ns';
41
- } else if (value < 1_000_000) {
42
- return (0, _components.formatValue)(value / 1_000, {
43
- unit: 'decimal',
44
- decimalPlaces: 2,
45
- shortValues: true
46
- }) + 'μs';
47
- } else {
48
- return (0, _spec.formatDuration)((0, _spec.convertTimeToDuration)(value / 1_000_000));
49
- }
50
- }
51
- function formatItemValue(unit, value) {
52
- let valueWithUnit = '';
53
- switch(unit){
54
- case 'count':
55
- valueWithUnit = (0, _components.formatValue)(value, {
56
- unit: 'decimal',
57
- decimalPlaces: 2,
58
- shortValues: true
59
- });
60
- break;
61
- case 'samples':
62
- valueWithUnit = (0, _components.formatValue)(value, {
63
- unit: 'decimal',
64
- decimalPlaces: 2,
65
- shortValues: true
66
- });
67
- break;
68
- case 'objects':
69
- valueWithUnit = (0, _components.formatValue)(value, {
70
- unit: 'decimal',
71
- decimalPlaces: 2,
72
- shortValues: true
73
- });
74
- break;
75
- case 'bytes':
76
- valueWithUnit = (0, _components.formatValue)(value, {
77
- unit: 'bytes'
78
- });
79
- break;
80
- case 'nanoseconds':
81
- valueWithUnit = formatNanoDuration(value);
82
- break;
83
- default:
84
- valueWithUnit = `${value} ${unit}`;
85
- break;
86
- }
87
- return valueWithUnit;
88
- }
@@ -1,68 +0,0 @@
1
- // Copyright 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: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get getColorByPackageName () {
25
- return getColorByPackageName;
26
- },
27
- get getColorByValue () {
28
- return getColorByValue;
29
- },
30
- get getSpanColor () {
31
- return getSpanColor;
32
- }
33
- });
34
- const _palette = require("./palette");
35
- const LESS_THAN_ONE_COLOR = '#dee2e6'; // use this color when the value is less than 1
36
- const MORE_THAN_HUNDRED_COLOR = '#ffbdbd'; // use this color when the value is more than 100
37
- const NOT_FOUND_COLOR = '#393d47';
38
- // Palette of color to display the flame chart by value
39
- const valueColorPalette = [
40
- '#fff85b',
41
- '#ffde4c',
42
- '#ffc252',
43
- '#ff8c00',
44
- '#f08c00',
45
- '#e67762',
46
- '#ff8c00',
47
- '#ff6f00',
48
- '#ff7070',
49
- '#ff3300',
50
- '#ff004c'
51
- ];
52
- function getSpanColor(palette, functionName, value) {
53
- if (palette === 'package-name') {
54
- return getColorByPackageName(functionName, value);
55
- }
56
- return getColorByValue(value);
57
- }
58
- function getColorByValue(value) {
59
- if (value < 1) return LESS_THAN_ONE_COLOR;
60
- if (value > 100) return MORE_THAN_HUNDRED_COLOR;
61
- return valueColorPalette[Math.floor(value / (valueColorPalette.length - 1))] || NOT_FOUND_COLOR;
62
- }
63
- function getColorByPackageName(functionName, value) {
64
- // get package name from the function name.
65
- // It is the substring between the last '/' and the first '.' or the end of the string
66
- const packageName = functionName.split('/').pop()?.split('.')[0] || functionName;
67
- return value < 1 ? LESS_THAN_ONE_COLOR : (0, _palette.getConsistentColor)(packageName, false);
68
- }
@@ -1,62 +0,0 @@
1
- // Copyright 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, "getConsistentColor", {
18
- enumerable: true,
19
- get: function() {
20
- return getConsistentColor;
21
- }
22
- });
23
- const _colorhash = /*#__PURE__*/ _interop_require_default(require("color-hash"));
24
- function _interop_require_default(obj) {
25
- return obj && obj.__esModule ? obj : {
26
- default: obj
27
- };
28
- }
29
- // Valid hue values are 0 to 360 and can be adjusted to control the generated colors.
30
- // More info: https://github.com/zenozeng/color-hash#custom-hue
31
- // Picked min of 20 and max of 360 to exclude common threshold colors (red).
32
- // Items with "error" in them will always be generated as red.
33
- const ERROR_HUE_CUTOFF = 20;
34
- const colorGenerator = new _colorhash.default({
35
- hue: {
36
- min: ERROR_HUE_CUTOFF,
37
- max: 360
38
- }
39
- });
40
- const redColorGenerator = new _colorhash.default({
41
- hue: {
42
- min: 0,
43
- max: ERROR_HUE_CUTOFF
44
- }
45
- });
46
- function computeConsistentColor(name, error) {
47
- const [hue, saturation, lightness] = error ? redColorGenerator.hsl(name) : colorGenerator.hsl(name);
48
- const saturationPercent = `${(saturation * 100).toFixed(0)}%`;
49
- const lightnessPercent = `${(lightness * 100).toFixed(0)}%`;
50
- return `hsla(${hue.toFixed(2)},${saturationPercent},${lightnessPercent},0.9)`;
51
- }
52
- // To check whether a color has already been generated for a given string.
53
- const colorLookup = {};
54
- function getConsistentColor(name, error) {
55
- const key = `${name}_____${error}`;
56
- let value = colorLookup[key];
57
- if (!value) {
58
- value = computeConsistentColor(name, error);
59
- colorLookup[key] = value;
60
- }
61
- return value;
62
- }
@@ -1,51 +0,0 @@
1
- // Copyright 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, "getSeriesTooltip", {
18
- enumerable: true,
19
- get: function() {
20
- return getSeriesTooltip;
21
- }
22
- });
23
- const _format = require("./format");
24
- function getSeriesTooltip(data, unit, name, color, divColor) {
25
- const date = new Date(data.value[0]);
26
- const formattedDate = date.toLocaleDateString('en-US', {
27
- month: 'short',
28
- day: '2-digit',
29
- year: 'numeric'
30
- });
31
- const formattedTime = date.toLocaleString('en-US', {
32
- hour: '2-digit',
33
- minute: '2-digit',
34
- second: '2-digit',
35
- hour12: false
36
- });
37
- return `
38
- <div>
39
- <div>
40
- ${formattedDate} - <b>${formattedTime}</b>
41
- </div>
42
- <hr style="border: none; border-top: 1px solid ${divColor}" />
43
- <div style="display: flex; align-items: center">
44
- <div style="margin-right: 8px; display: inline-block; width: 11px; height: 11px; border-radius: 2px; background-color: ${color}"></div>
45
- <div style="width: 100%; display: flex; justify-content: space-between" >
46
- <span style="margin-right: 8px">${name}</span> <b>${(0, _format.formatItemValue)(unit, data.value[1])}</b>
47
- </div>
48
- </div>
49
- </div>
50
- `;
51
- }