@kylincloud/flamegraph 0.35.6

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 (267) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +202 -0
  3. package/README.md +251 -0
  4. package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts +2 -0
  5. package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts.map +1 -0
  6. package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts +17 -0
  7. package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts.map +1 -0
  8. package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts +14 -0
  9. package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts.map +1 -0
  10. package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts +9 -0
  11. package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts.map +1 -0
  12. package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts +8 -0
  13. package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts.map +1 -0
  14. package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts +96 -0
  15. package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts.map +1 -0
  16. package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts +27 -0
  17. package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts.map +1 -0
  18. package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts +7 -0
  19. package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts.map +1 -0
  20. package/dist/FlameGraph/FlameGraphComponent/Header.d.ts +12 -0
  21. package/dist/FlameGraph/FlameGraphComponent/Header.d.ts.map +1 -0
  22. package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts +18 -0
  23. package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts.map +1 -0
  24. package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts +2 -0
  25. package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts.map +1 -0
  26. package/dist/FlameGraph/FlameGraphComponent/color.d.ts +20 -0
  27. package/dist/FlameGraph/FlameGraphComponent/color.d.ts.map +1 -0
  28. package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts +11 -0
  29. package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts.map +1 -0
  30. package/dist/FlameGraph/FlameGraphComponent/constants.d.ts +6 -0
  31. package/dist/FlameGraph/FlameGraphComponent/constants.d.ts.map +1 -0
  32. package/dist/FlameGraph/FlameGraphComponent/index.d.ts +37 -0
  33. package/dist/FlameGraph/FlameGraphComponent/index.d.ts.map +1 -0
  34. package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts +2 -0
  35. package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts.map +1 -0
  36. package/dist/FlameGraph/FlameGraphComponent/testData.d.ts +53 -0
  37. package/dist/FlameGraph/FlameGraphComponent/testData.d.ts.map +1 -0
  38. package/dist/FlameGraph/FlameGraphComponent/utils.d.ts +6 -0
  39. package/dist/FlameGraph/FlameGraphComponent/utils.d.ts.map +1 -0
  40. package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts +2 -0
  41. package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts.map +1 -0
  42. package/dist/FlameGraph/FlameGraphRenderer.d.ts +86 -0
  43. package/dist/FlameGraph/FlameGraphRenderer.d.ts.map +1 -0
  44. package/dist/FlameGraph/decode.d.ts +27 -0
  45. package/dist/FlameGraph/decode.d.ts.map +1 -0
  46. package/dist/FlameGraph/normalize.d.ts +6 -0
  47. package/dist/FlameGraph/normalize.d.ts.map +1 -0
  48. package/dist/FlameGraph/uniqueness.d.ts +3 -0
  49. package/dist/FlameGraph/uniqueness.d.ts.map +1 -0
  50. package/dist/FlamegraphRenderer.d.ts +19 -0
  51. package/dist/FlamegraphRenderer.d.ts.map +1 -0
  52. package/dist/Icons.d.ts +9 -0
  53. package/dist/Icons.d.ts.map +1 -0
  54. package/dist/ProfilerTable.d.ts +21 -0
  55. package/dist/ProfilerTable.d.ts.map +1 -0
  56. package/dist/SharedQueryInput.d.ts +10 -0
  57. package/dist/SharedQueryInput.d.ts.map +1 -0
  58. package/dist/Toolbar.d.ts +31 -0
  59. package/dist/Toolbar.d.ts.map +1 -0
  60. package/dist/Tooltip/FlamegraphTooltip.d.ts +59 -0
  61. package/dist/Tooltip/FlamegraphTooltip.d.ts.map +1 -0
  62. package/dist/Tooltip/LeftClickIcon.d.ts +2 -0
  63. package/dist/Tooltip/LeftClickIcon.d.ts.map +1 -0
  64. package/dist/Tooltip/RightClickIcon.d.ts +2 -0
  65. package/dist/Tooltip/RightClickIcon.d.ts.map +1 -0
  66. package/dist/Tooltip/TableTooltip.d.ts +12 -0
  67. package/dist/Tooltip/TableTooltip.d.ts.map +1 -0
  68. package/dist/Tooltip/Tooltip.d.ts +29 -0
  69. package/dist/Tooltip/Tooltip.d.ts.map +1 -0
  70. package/dist/convert/convertJaegerTraceToProfile.d.ts +3 -0
  71. package/dist/convert/convertJaegerTraceToProfile.d.ts.map +1 -0
  72. package/dist/convert/diffTwoProfiles.d.ts +3 -0
  73. package/dist/convert/diffTwoProfiles.d.ts.map +1 -0
  74. package/dist/convert/flamebearersToTree.d.ts +11 -0
  75. package/dist/convert/flamebearersToTree.d.ts.map +1 -0
  76. package/dist/convert/sandwichViewProfiles.d.ts +14 -0
  77. package/dist/convert/sandwichViewProfiles.d.ts.map +1 -0
  78. package/dist/convert/subtract.d.ts +3 -0
  79. package/dist/convert/subtract.d.ts.map +1 -0
  80. package/dist/convert/testData.d.ts +50 -0
  81. package/dist/convert/testData.d.ts.map +1 -0
  82. package/dist/convert/toGraphviz.d.ts +3 -0
  83. package/dist/convert/toGraphviz.d.ts.map +1 -0
  84. package/dist/fitMode/fitMode.d.ts +42 -0
  85. package/dist/fitMode/fitMode.d.ts.map +1 -0
  86. package/dist/format/format.d.ts +42 -0
  87. package/dist/format/format.d.ts.map +1 -0
  88. package/dist/i18n.d.ts +55 -0
  89. package/dist/i18n.d.ts.map +1 -0
  90. package/dist/index.cjs.css +792 -0
  91. package/dist/index.cjs.js +5087 -0
  92. package/dist/index.d.ts +4 -0
  93. package/dist/index.d.ts.map +1 -0
  94. package/dist/index.esm.css +792 -0
  95. package/dist/index.esm.js +5079 -0
  96. package/dist/index.node.d.ts +9 -0
  97. package/dist/index.node.d.ts.map +1 -0
  98. package/dist/logo-v3-small-T5VXIMRR.svg +32 -0
  99. package/dist/models/decode.d.ts +3 -0
  100. package/dist/models/decode.d.ts.map +1 -0
  101. package/dist/models/flamebearer.d.ts +63 -0
  102. package/dist/models/flamebearer.d.ts.map +1 -0
  103. package/dist/models/groups.d.ts +37 -0
  104. package/dist/models/groups.d.ts.map +1 -0
  105. package/dist/models/index.d.ts +8 -0
  106. package/dist/models/index.d.ts.map +1 -0
  107. package/dist/models/profile.d.ts +152 -0
  108. package/dist/models/profile.d.ts.map +1 -0
  109. package/dist/models/spyName.d.ts +8 -0
  110. package/dist/models/spyName.d.ts.map +1 -0
  111. package/dist/models/trace.d.ts +357 -0
  112. package/dist/models/trace.d.ts.map +1 -0
  113. package/dist/models/units.d.ts +6 -0
  114. package/dist/models/units.d.ts.map +1 -0
  115. package/dist/search.d.ts +2 -0
  116. package/dist/search.d.ts.map +1 -0
  117. package/dist/shims/Box.d.ts +38 -0
  118. package/dist/shims/Box.d.ts.map +1 -0
  119. package/dist/shims/Button.d.ts +26 -0
  120. package/dist/shims/Button.d.ts.map +1 -0
  121. package/dist/shims/Dropdown.d.ts +30 -0
  122. package/dist/shims/Dropdown.d.ts.map +1 -0
  123. package/dist/shims/Input.d.ts +19 -0
  124. package/dist/shims/Input.d.ts.map +1 -0
  125. package/dist/shims/LoadingSpinner.d.ts +7 -0
  126. package/dist/shims/LoadingSpinner.d.ts.map +1 -0
  127. package/dist/shims/Menu.d.ts +4 -0
  128. package/dist/shims/Menu.d.ts.map +1 -0
  129. package/dist/shims/NoData.d.ts +2 -0
  130. package/dist/shims/NoData.d.ts.map +1 -0
  131. package/dist/shims/Table.d.ts +52 -0
  132. package/dist/shims/Table.d.ts.map +1 -0
  133. package/dist/shims/Tooltip.d.ts +9 -0
  134. package/dist/shims/Tooltip.d.ts.map +1 -0
  135. package/package.json +84 -0
  136. package/src/FlameGraph/FlameGraphComponent/CheckIcon.tsx +27 -0
  137. package/src/FlameGraph/FlameGraphComponent/ContextMenu.module.scss +10 -0
  138. package/src/FlameGraph/FlameGraphComponent/ContextMenu.spec.tsx +84 -0
  139. package/src/FlameGraph/FlameGraphComponent/ContextMenu.tsx +86 -0
  140. package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.module.css +8 -0
  141. package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.tsx +47 -0
  142. package/src/FlameGraph/FlameGraphComponent/DiffLegend.module.css +21 -0
  143. package/src/FlameGraph/FlameGraphComponent/DiffLegend.tsx +52 -0
  144. package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.module.css +40 -0
  145. package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.tsx +129 -0
  146. package/src/FlameGraph/FlameGraphComponent/Flamegraph.spec.ts +552 -0
  147. package/src/FlameGraph/FlameGraphComponent/Flamegraph.ts +446 -0
  148. package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.spec.tsx +233 -0
  149. package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.ts +478 -0
  150. package/src/FlameGraph/FlameGraphComponent/GraphVizPane.tsx +56 -0
  151. package/src/FlameGraph/FlameGraphComponent/GraphVizPanel.module.scss +55 -0
  152. package/src/FlameGraph/FlameGraphComponent/Header.module.css +27 -0
  153. package/src/FlameGraph/FlameGraphComponent/Header.tsx +71 -0
  154. package/src/FlameGraph/FlameGraphComponent/Highlight.module.css +7 -0
  155. package/src/FlameGraph/FlameGraphComponent/Highlight.spec.tsx +53 -0
  156. package/src/FlameGraph/FlameGraphComponent/Highlight.tsx +94 -0
  157. package/src/FlameGraph/FlameGraphComponent/LogoLink.module.scss +10 -0
  158. package/src/FlameGraph/FlameGraphComponent/LogoLink.tsx +101 -0
  159. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-collapses-small-blocks-into-one-1-snap.png +0 -0
  160. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-diff-mode-1-snap.png +0 -0
  161. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-highlighted-flamegraph-1-snap.png +0 -0
  162. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-normal-flamegraph-1-snap.png +0 -0
  163. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-selected-node-1-snap.png +0 -0
  164. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-also-zooms-1-snap.png +0 -0
  165. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-in-the-beginning-1-snap.png +0 -0
  166. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-when-node-is-not-in-the-beginning-1-snap.png +0 -0
  167. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-zoom-top-level-1-snap.png +0 -0
  168. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-complex-flamegraph-1-snap.png +0 -0
  169. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-double-diff-flamegraph-1-snap.png +0 -0
  170. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-double-flamegraph-1-snap.png +0 -0
  171. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-flamegraph-1-snap.png +0 -0
  172. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-flamegraph-1-snap.png +0 -0
  173. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-tree-1-snap.png +0 -0
  174. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-flamegraph-1-snap.png +0 -0
  175. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-with-fit-mode-tail-1-snap.png +0 -0
  176. package/src/FlameGraph/FlameGraphComponent/canvas.module.css +6 -0
  177. package/src/FlameGraph/FlameGraphComponent/color.spec.ts +308 -0
  178. package/src/FlameGraph/FlameGraphComponent/color.ts +167 -0
  179. package/src/FlameGraph/FlameGraphComponent/colorPalette.ts +58 -0
  180. package/src/FlameGraph/FlameGraphComponent/constants.ts +5 -0
  181. package/src/FlameGraph/FlameGraphComponent/index.spec.tsx +291 -0
  182. package/src/FlameGraph/FlameGraphComponent/index.tsx +411 -0
  183. package/src/FlameGraph/FlameGraphComponent/murmur3.ts +97 -0
  184. package/src/FlameGraph/FlameGraphComponent/styles.module.scss +10 -0
  185. package/src/FlameGraph/FlameGraphComponent/testData.ts +427 -0
  186. package/src/FlameGraph/FlameGraphComponent/utils.ts +31 -0
  187. package/src/FlameGraph/FlameGraphComponent/viewTypes.ts +6 -0
  188. package/src/FlameGraph/FlameGraphRenderer.tsx +603 -0
  189. package/src/FlameGraph/FlamegraphRenderer.module.scss +93 -0
  190. package/src/FlameGraph/decode.ts +78 -0
  191. package/src/FlameGraph/normalize.spec.ts +76 -0
  192. package/src/FlameGraph/normalize.ts +60 -0
  193. package/src/FlameGraph/testData.json +423 -0
  194. package/src/FlameGraph/uniqueness.spec.ts +16 -0
  195. package/src/FlameGraph/uniqueness.ts +84 -0
  196. package/src/FlamegraphRenderer.tsx +61 -0
  197. package/src/Icons.tsx +74 -0
  198. package/src/ProfilerTable.tsx +527 -0
  199. package/src/SharedQueryInput.module.scss +82 -0
  200. package/src/SharedQueryInput.tsx +127 -0
  201. package/src/Toolbar.module.scss +117 -0
  202. package/src/Toolbar.spec.tsx +217 -0
  203. package/src/Toolbar.tsx +471 -0
  204. package/src/Tooltip/FlamegraphTooltip.spec.tsx +81 -0
  205. package/src/Tooltip/FlamegraphTooltip.tsx +257 -0
  206. package/src/Tooltip/LeftClickIcon.tsx +18 -0
  207. package/src/Tooltip/RightClickIcon.tsx +18 -0
  208. package/src/Tooltip/TableTooltip.spec.tsx +44 -0
  209. package/src/Tooltip/TableTooltip.tsx +145 -0
  210. package/src/Tooltip/Tooltip.module.scss +71 -0
  211. package/src/Tooltip/Tooltip.spec.tsx +395 -0
  212. package/src/Tooltip/Tooltip.tsx +336 -0
  213. package/src/__snapshots__/Toolbar.spec.tsx.snap +297 -0
  214. package/src/convert/convertJaegerTraceToProfile.ts +97 -0
  215. package/src/convert/diffTwoProfiles.ts +81 -0
  216. package/src/convert/flamebearersToTree.ts +78 -0
  217. package/src/convert/sandwichViewProfiles.spec.ts +65 -0
  218. package/src/convert/sandwichViewProfiles.ts +191 -0
  219. package/src/convert/subtract.ts +87 -0
  220. package/src/convert/testData.ts +145 -0
  221. package/src/convert/toGraphviz.ts +485 -0
  222. package/src/fitMode/fitMode.spec.ts +93 -0
  223. package/src/fitMode/fitMode.ts +122 -0
  224. package/src/format/format.spec.ts +291 -0
  225. package/src/format/format.ts +303 -0
  226. package/src/globals.d.ts +13 -0
  227. package/src/i18n.tsx +293 -0
  228. package/src/index.node.ts +19 -0
  229. package/src/index.spec.tsx +383 -0
  230. package/src/index.tsx +10 -0
  231. package/src/logo-v3-small.svg +32 -0
  232. package/src/models/decode.ts +45 -0
  233. package/src/models/flamebearer.ts +86 -0
  234. package/src/models/groups.ts +14 -0
  235. package/src/models/index.ts +7 -0
  236. package/src/models/profile.spec.ts +32 -0
  237. package/src/models/profile.ts +48 -0
  238. package/src/models/spyName.spec.ts +18 -0
  239. package/src/models/spyName.ts +32 -0
  240. package/src/models/trace.ts +45 -0
  241. package/src/models/units.spec.ts +21 -0
  242. package/src/models/units.ts +24 -0
  243. package/src/sass/_common.scss +206 -0
  244. package/src/sass/_css-variables.scss +201 -0
  245. package/src/sass/_mixins.scss +15 -0
  246. package/src/sass/_sanitize.scss +407 -0
  247. package/src/sass/_variables.scss +53 -0
  248. package/src/sass/flamegraph.scss +18 -0
  249. package/src/search.spec.ts +11 -0
  250. package/src/search.ts +4 -0
  251. package/src/shameful-any.d.ts +2 -0
  252. package/src/shims/Box.module.scss +57 -0
  253. package/src/shims/Box.tsx +105 -0
  254. package/src/shims/Button.module.scss +129 -0
  255. package/src/shims/Button.tsx +128 -0
  256. package/src/shims/Dropdown.module.scss +63 -0
  257. package/src/shims/Dropdown.tsx +96 -0
  258. package/src/shims/Input.module.scss +15 -0
  259. package/src/shims/Input.tsx +55 -0
  260. package/src/shims/LoadingSpinner.tsx +19 -0
  261. package/src/shims/Menu.tsx +9 -0
  262. package/src/shims/NoData.module.scss +6 -0
  263. package/src/shims/NoData.tsx +11 -0
  264. package/src/shims/Table.module.scss +82 -0
  265. package/src/shims/Table.spec.tsx +121 -0
  266. package/src/shims/Table.tsx +252 -0
  267. package/src/shims/Tooltip.tsx +51 -0
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+
3
+ export type SpyNameFirstClassType = typeof SpyNameFirstClass[number];
4
+
5
+ export const SpyNameFirstClass = [
6
+ 'dotnetspy',
7
+ 'ebpfspy',
8
+ 'gospy',
9
+ 'phpspy',
10
+ 'pyspy',
11
+ 'rbspy',
12
+ 'nodespy',
13
+ 'javaspy',
14
+ 'pyroscope-rs',
15
+ ] as const;
16
+
17
+ export const SpyNameOther = [
18
+ 'scrape', // for compability purposes, it should be golang
19
+ 'tracing',
20
+ 'unknown',
21
+ ] as const;
22
+
23
+ export const AllSpyNames = [...SpyNameFirstClass, ...SpyNameOther] as const;
24
+
25
+ export const SpyNameSchema = z.preprocess((val) => {
26
+ if (!val || !AllSpyNames.includes(val as typeof AllSpyNames[number])) {
27
+ return 'unknown';
28
+ }
29
+ return val;
30
+ }, z.enum(AllSpyNames).default('unknown'));
31
+
32
+ export type SpyName = z.infer<typeof SpyNameSchema>;
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+
3
+ const ReferencesSchema = z.object({
4
+ refType: z.string(),
5
+ traceID: z.string(),
6
+ spanID: z.string(),
7
+ });
8
+
9
+ const TagsSchema = z.object({
10
+ key: z.string(),
11
+ type: z.string(),
12
+ value: z.union([z.boolean(), z.number(), z.string()]),
13
+ });
14
+
15
+ const TraceSpanSchema = z.object({
16
+ traceID: z.string(),
17
+ spanID: z.string(),
18
+ flags: z.string(),
19
+ operationName: z.string(),
20
+ references: z.array(ReferencesSchema),
21
+ startTime: z.number(),
22
+ duration: z.number(),
23
+ tags: z.array(TagsSchema),
24
+ logs: z.object({
25
+ timestamp: z.number(),
26
+ fields: z.array(TagsSchema),
27
+ }),
28
+ processID: z.string(),
29
+ warnings: z.any(),
30
+ });
31
+
32
+ const ProcessSchema = z.object({
33
+ serviceName: z.string(),
34
+ tags: z.array(TagsSchema),
35
+ });
36
+
37
+ const TraceSchema = z.object({
38
+ traceID: z.string(),
39
+ spans: z.array(TraceSpanSchema),
40
+ processes: z.record(ProcessSchema),
41
+ warnings: z.any(),
42
+ });
43
+
44
+ export type Trace = z.infer<typeof TraceSchema>;
45
+ export type TraceSpan = z.infer<typeof TraceSpanSchema>;
@@ -0,0 +1,21 @@
1
+ import { units, UnitsSchema } from './units';
2
+
3
+ describe('Units', function () {
4
+ test.each(units.map((a) => [a, a]))(
5
+ 'parse("%s") should return "%s"',
6
+ (spyName) => {
7
+ expect(UnitsSchema.parse(spyName)).toBe(spyName);
8
+ }
9
+ );
10
+
11
+ describe('when empty', () => {
12
+ it('defaults to unknown', () => {
13
+ expect(UnitsSchema.parse('')).toBe('unknown');
14
+ });
15
+ });
16
+ describe('when a non-supported value is passed', () => {
17
+ it('defaults to unknown', () => {
18
+ expect(UnitsSchema.parse('UNKNOWN_UNIT')).toBe('unknown');
19
+ });
20
+ });
21
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+
3
+ export const units = [
4
+ 'samples',
5
+ 'objects',
6
+ 'goroutines',
7
+ 'bytes',
8
+ 'lock_samples',
9
+ 'lock_nanoseconds',
10
+ 'trace_samples',
11
+ 'exceptions',
12
+ ];
13
+
14
+ export const UnitsSchema = z.preprocess((u) => {
15
+ if (typeof u === 'string') {
16
+ if (units.includes(u)) {
17
+ return u;
18
+ }
19
+ }
20
+ return 'unknown';
21
+ }, z.enum(['samples', 'objects', 'goroutines', 'bytes', 'lock_samples', 'lock_nanoseconds', 'trace_samples', 'exceptions', 'unknown']));
22
+
23
+ export type UnitsType = typeof units[number];
24
+ export type Units = z.infer<typeof UnitsSchema>;
@@ -0,0 +1,206 @@
1
+ // ==========================================================================
2
+ // Common - 通用组件样式
3
+ // ==========================================================================
4
+
5
+ @use '../sass/mixins' as *;
6
+
7
+ // --------------------------------------------------------------------------
8
+ // Code & Pre
9
+ // --------------------------------------------------------------------------
10
+
11
+ pre,
12
+ code,
13
+ tt {
14
+ font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
15
+ font-size: 14px;
16
+ }
17
+
18
+ tt {
19
+ border-radius: 3px;
20
+ border: 1px solid var(--ps-gray-light-4);
21
+ padding: 2px 4px;
22
+ background-color: var(--ps-ui-foreground-text);
23
+ }
24
+
25
+ // --------------------------------------------------------------------------
26
+ // Navbar
27
+ // --------------------------------------------------------------------------
28
+
29
+ .navbar {
30
+ display: flex;
31
+ height: 60px;
32
+ align-items: center;
33
+
34
+ .logo {
35
+ margin: 0;
36
+ padding: 0;
37
+ font-weight: 400;
38
+ background-size: 40px 40px;
39
+ background-position: 0px 8px;
40
+ background-repeat: no-repeat;
41
+
42
+ &::after {
43
+ content: 'Pyroscope';
44
+ font-weight: 400;
45
+ padding-left: 44px;
46
+ font-size: 25px;
47
+ vertical-align: text-top;
48
+ }
49
+ }
50
+ }
51
+
52
+ .navbar,
53
+ .footer {
54
+ .navbar-link {
55
+ margin-left: 30px;
56
+
57
+ a {
58
+ color: var(--ps-neutral-2);
59
+ text-decoration: none;
60
+ font-weight: 500;
61
+
62
+ &:hover {
63
+ color: var(--ps-neutral-2);
64
+ cursor: pointer;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ // --------------------------------------------------------------------------
71
+ // Flamegraph Table
72
+ // --------------------------------------------------------------------------
73
+
74
+ .flamegraph-table {
75
+ width: 100%;
76
+ font-size: 14px;
77
+ border: 1px solid var(--ps-ui-border);
78
+
79
+ thead th {
80
+ color: var(--ps-neutral-2);
81
+ }
82
+
83
+ th,
84
+ td {
85
+ color: var(--ps-neutral-2);
86
+ text-align: right;
87
+ padding: 0px 10px;
88
+ border-left: 1px solid var(--ps-ui-border);
89
+ border-bottom: 1px solid var(--ps-ui-border);
90
+ width: 150px;
91
+ min-width: 150px;
92
+ max-width: 150px;
93
+
94
+ span {
95
+ text-shadow: 0 0 1px var(--ps-table-row-text-shadow);
96
+ }
97
+
98
+ &:first-child {
99
+ border-left: none;
100
+ text-align: left;
101
+ width: auto;
102
+ min-width: auto;
103
+ max-width: auto;
104
+ white-space: nowrap;
105
+ }
106
+
107
+ &:first-child .color-reference {
108
+ position: absolute;
109
+ left: 10px;
110
+ bottom: 0;
111
+ top: 0;
112
+ margin: auto;
113
+ }
114
+ }
115
+
116
+ // Double column variant
117
+ &.flamegraph-table-doubles th,
118
+ &.flamegraph-table-doubles td {
119
+ width: 130px;
120
+ min-width: 130px;
121
+ max-width: 130px;
122
+
123
+ &:first-child {
124
+ width: auto;
125
+ min-width: auto;
126
+ max-width: auto;
127
+ }
128
+ }
129
+
130
+ .symbol-name {
131
+ font-size: 14px;
132
+ font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
133
+ }
134
+
135
+ th {
136
+ padding: 6px 10px;
137
+ }
138
+
139
+ tr th,
140
+ tr:nth-child(2n) td {
141
+ background: var(--ps-neutral-9);
142
+ }
143
+
144
+ td {
145
+ font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
146
+
147
+ &:first-child {
148
+ margin-left: 15px;
149
+ position: relative;
150
+ }
151
+
152
+ // element right next the color reference
153
+ &:first-child .color-reference + div {
154
+ margin-left: 15px;
155
+ }
156
+
157
+ .table-item-button {
158
+ border: none;
159
+ display: flex;
160
+ flex-flow: row nowrap;
161
+ align-items: baseline;
162
+ width: 100%;
163
+ cursor: pointer;
164
+ background-color: transparent;
165
+ }
166
+ }
167
+
168
+ .unsupported-format {
169
+ text-align: center;
170
+ padding: 15px 40px;
171
+ }
172
+ }
173
+
174
+ // --------------------------------------------------------------------------
175
+ // Color Reference
176
+ // --------------------------------------------------------------------------
177
+
178
+ .color-reference {
179
+ width: 10px;
180
+ height: 10px;
181
+ border-radius: 2px;
182
+ display: inline-block;
183
+ margin-right: 5px;
184
+ }
185
+
186
+ // --------------------------------------------------------------------------
187
+ // Button Group
188
+ // --------------------------------------------------------------------------
189
+
190
+ .btn-group {
191
+ display: flex;
192
+
193
+ .btn {
194
+ border-radius: 0;
195
+ border-left: none;
196
+
197
+ &:first-child {
198
+ border-left: 1px solid var(--ps-ui-border);
199
+ border-radius: 4px 0 0 4px;
200
+ }
201
+
202
+ &:last-child {
203
+ border-radius: 0 4px 4px 0;
204
+ }
205
+ }
206
+ }
@@ -0,0 +1,201 @@
1
+ // src/sass/_css-variables.scss
2
+ // ==========================================================================
3
+ // Flamegraph 主题变量(Dark / Light / Kylin)
4
+ // 说明:
5
+ // - :root / data-theme="dark" / data-flamegraph-color-mode="dark" => 暗色默认
6
+ // - data-theme="light" / data-theme="kylin"
7
+ // / data-flamegraph-color-mode="light" / "kylin" => 浅色基线
8
+ // - data-theme="kylin" / data-flamegraph-color-mode="kylin"
9
+ // => 在浅色基线上做 Kylin 风格微调(接近 AntD)
10
+ // ==========================================================================
11
+
12
+ // ==========================================================================
13
+ // Dark Theme(默认)
14
+ // ==========================================================================
15
+ :root,
16
+ [data-theme='dark'],
17
+ [data-flamegraph-color-mode='dark'] {
18
+ // 基础中性色
19
+ --ps-neutral-1: #000000;
20
+ --ps-neutral-2: #ffffff;
21
+ --ps-neutral-9: #ffffff08;
22
+
23
+ // UI 层级背景色 (由远到近)
24
+ --ps-ui-background: #0e0e13;
25
+ --ps-ui-foreground: #212124;
26
+ --ps-ui-element-bg-primary: #2c2c30;
27
+ --ps-ui-element-bg-highlight: #47474e;
28
+
29
+ // 边框与禁用状态
30
+ --ps-ui-border: #3b3b44;
31
+ --ps-disabled-button-text: #404047;
32
+ --ps-ui-foreground-text: #d8d8d8;
33
+ --ps-sidebar-separator: #d8d8d833;
34
+
35
+ // 下拉菜单
36
+ --ps-dropdown-background: #2c2c30;
37
+ --ps-dropdown-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' fill='white' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E");
38
+ --ps-dropdown-shadow: #000000;
39
+
40
+ // Tooltip
41
+ --ps-tooltip-bg: #ffffff;
42
+ --ps-tooltip-text: #000000;
43
+ --ps-tooltip-header-bg: #d8d8d8;
44
+ --ps-right-click-info: #9a9aa0;
45
+ --ps-sandwich-pane-info-bg: #f2cd50;
46
+
47
+ // 按钮开关
48
+ --ps-button-switch-bg: #2ecc40;
49
+ --ps-button-switch-bg-highlight: #61ea71;
50
+ --ps-button-switch-text: #242428;
51
+
52
+ // 表格
53
+ --ps-table-highlight-row-bg: #2ecc40;
54
+ --ps-table-highlight-row-text: #000000;
55
+ --ps-table-row-text-shadow: #000000;
56
+
57
+ // 选择器
58
+ --ps-selected-app: #df8b53;
59
+ --ps-select-modal-title: #888888;
60
+ --ps-app-selector-filter: #9d9d9f;
61
+
62
+ // 主色调 - 蓝色
63
+ --ps-blue-primary: #3b78e7;
64
+ --ps-blue-highlight: #578ae9;
65
+ --ps-blue-disabled: #5374b0;
66
+
67
+ // 主色调 - 绿色
68
+ --ps-green-primary: #2ecc40;
69
+ --ps-green-highlight: #61ea71;
70
+ --ps-green-disabled: #85c985;
71
+
72
+ // 主色调 - 红色
73
+ --ps-red-primary: #dc3545;
74
+ --ps-red-highlight: #e4606d;
75
+ --ps-red-disabled: #eb8c95;
76
+
77
+ // 主色调 - 灰色
78
+ --ps-grey-primary: #3b3b44;
79
+ --ps-grey-highlight: #47474e;
80
+ --ps-grey-disabled: #404047;
81
+
82
+ // 不可变色 (固定值,不随主题变化)
83
+ --ps-immutable-green-button-text: #242428;
84
+ --ps-immutable-google-button: #e84d3c;
85
+ --ps-immutable-google-button-hover: #e53825;
86
+ --ps-immutable-gitlab-button: #3b3b44;
87
+ --ps-immutable-gitlab-button-hover: #47474e;
88
+ --ps-immutable-gradient-0: #d1283980;
89
+ --ps-immutable-gradient-1: #3dc1d3cc;
90
+ --ps-immutable-off-white: #e6e6e6;
91
+ --ps-immutable-linked-border: #eb7b18;
92
+ --ps-immutable-white: #ffffff;
93
+ --ps-immutable-placeholder-text: #333333;
94
+
95
+ // 上传区域
96
+ --ps-upload-profile-area-border: #4d4d4d;
97
+ --ps-upload-profile-area-bg: #2c2c30;
98
+ --ps-upload-profile-btn-bg: #2c2c30;
99
+ --ps-upload-profile-icon: #575a6d;
100
+ --ps-upload-profile-btn-color: rgba(255, 255, 255, 0.3);
101
+
102
+ // 工具栏
103
+ --ps-fl-toolbar-bg: #2c2c30;
104
+ --ps-fl-toolbar-btn-bg: #3c7150;
105
+ --ps-toolbar-icon-color: #ffffff;
106
+
107
+ // MUI Tooltip
108
+ --ps-mui-tooltip-background: #3b3b44;
109
+ }
110
+
111
+ // ==========================================================================
112
+ // Light Theme + Kylin 基线主题(共同的浅色基线)
113
+ // 说明:light 和 kylin 先共享一整套浅色变量,避免回退到 dark
114
+ // ==========================================================================
115
+ [data-theme='light'],
116
+ [data-theme='kylin'], // ✅ 新增:Box 主题为 kylin 时也用浅色基线
117
+ [data-flamegraph-color-mode='light'],
118
+ [data-flamegraph-color-mode='kylin'] {
119
+ --ps-neutral-1: #ffffff;
120
+ --ps-neutral-2: #000000;
121
+ --ps-neutral-9: #00000008;
122
+
123
+ --ps-ui-element-bg-primary: #f8f8f8;
124
+ --ps-ui-element-bg-highlight: #c4c4c4;
125
+
126
+ --ps-ui-background: #eaeaea;
127
+ --ps-ui-border: #cccccc;
128
+ --ps-disabled-button-text: #cccccc;
129
+ --ps-ui-foreground: #f8f8f8;
130
+ --ps-ui-foreground-text: #272727;
131
+ --ps-dropdown-background: #f8f8f8;
132
+ --ps-sidebar-separator: #0000004d;
133
+
134
+ --ps-tooltip-bg: #ffffff;
135
+ --ps-tooltip-text: #000000;
136
+ --ps-tooltip-header-bg: #d8d8d8;
137
+ --ps-right-click-info: #9a9aa0;
138
+ --ps-sandwich-pane-info-bg: #3b78e7;
139
+
140
+ --ps-dropdown-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' fill='black' height='4'%3E%3Cpath d='M4 0h6L7 4'/%3E%3C/svg%3E");
141
+ --ps-dropdown-shadow: #00000052;
142
+
143
+ --ps-button-switch-bg: #3b78e7;
144
+ --ps-button-switch-bg-highlight: #578ae9;
145
+ --ps-button-switch-text: #ffffff;
146
+
147
+ --ps-table-highlight-row-bg: #3b78e7;
148
+ --ps-table-highlight-row-text: #ffffff;
149
+ --ps-table-row-text-shadow: #ffffff;
150
+ --ps-selected-app: #3b78e7;
151
+ --ps-select-modal-title: #888888;
152
+
153
+ --ps-green-primary: #0bdb79;
154
+ --ps-green-highlight: #5bdc9e;
155
+ --ps-green-disabled: #00a757;
156
+
157
+ --ps-upload-profile-area-border: #d8d8d8;
158
+ --ps-upload-profile-area-bg: #f8f8f8;
159
+ --ps-upload-profile-btn-bg: #f8f8f8;
160
+ --ps-upload-profile-icon: #cccccc;
161
+ --ps-upload-profile-btn-color: rgba(255, 255, 255, 0.3);
162
+
163
+ --ps-fl-toolbar-bg: #00000008;
164
+ --ps-fl-toolbar-btn-bg: #3b78e7;
165
+ --ps-toolbar-icon-color: #5f6367;
166
+
167
+ --ps-mui-tooltip-background: #5f6367;
168
+ --ps-app-selector-filter: #9d9d9f;
169
+ }
170
+
171
+ // ==========================================================================
172
+ // Kylin Theme - 在浅色基线上的微调(更贴近 AntD 白色系)
173
+ // ==========================================================================
174
+ [data-theme='kylin'], // ✅ 新增:Box 主题为 kylin 时应用这些微调
175
+ [data-flamegraph-color-mode='kylin'] {
176
+ // 整体背景更接近 AntD
177
+ --ps-ui-background: #f5f5f5;
178
+ --ps-ui-foreground: #ffffff;
179
+ --ps-ui-border: #d9d9d9;
180
+ --ps-ui-foreground-text: #000000;
181
+
182
+ // 工具栏更像 AntD Head / Layout
183
+ --ps-fl-toolbar-bg: #fafafa;
184
+ --ps-fl-toolbar-btn-bg: #1677ff;
185
+ --ps-toolbar-icon-color: #595959;
186
+
187
+ // 表格高亮行风格:浅蓝背景 + 黑字
188
+ --ps-table-highlight-row-bg: #e6f4ff;
189
+ --ps-table-highlight-row-text: #000000;
190
+
191
+ // 开关按钮风格:AntD 主色
192
+ --ps-button-switch-bg: #1677ff;
193
+ --ps-button-switch-bg-highlight: #4096ff;
194
+ --ps-button-switch-text: #ffffff;
195
+
196
+ // 下拉 / Tooltip 更白净一点
197
+ --ps-dropdown-background: #ffffff;
198
+ --ps-tooltip-bg: #ffffff;
199
+ --ps-tooltip-text: #000000;
200
+ --ps-tooltip-header-bg: #f0f0f0;
201
+ }
@@ -0,0 +1,15 @@
1
+ // ==========================================================================
2
+ // Mixins
3
+ // ==========================================================================
4
+
5
+ @mixin outline {
6
+ outline: none;
7
+
8
+ &:focus {
9
+ outline: none;
10
+ }
11
+
12
+ &:focus:active {
13
+ outline: none;
14
+ }
15
+ }