@parca/profile 0.19.140 → 0.19.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
  9. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
  10. package/dist/MatchersInput/SuggestionItem.js +91 -12
  11. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  12. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  13. package/dist/MatchersInput/SuggestionsList.js +371 -157
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  15. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  16. package/dist/MatchersInput/index.js +308 -115
  17. package/dist/MetricsCircle/index.js +39 -3
  18. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  19. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  20. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  21. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  22. package/dist/MetricsGraph/index.js +552 -203
  23. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  24. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  25. package/dist/MetricsSeries/index.js +70 -7
  26. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  27. package/dist/PreSelectedMatchers/index.js +249 -102
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  29. package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
  30. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  31. package/dist/ProfileExplorer/index.js +183 -32
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  33. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  34. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  35. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  36. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  37. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  38. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  39. package/dist/ProfileFlameChart/index.js +267 -129
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  56. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  57. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  58. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  59. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  60. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  61. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  62. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  63. package/dist/ProfileFlameGraph/index.js +324 -150
  64. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  65. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  66. package/dist/ProfileMetricsGraph/index.js +519 -258
  67. package/dist/ProfileSelector/CompareButton.js +132 -12
  68. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  69. package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
  70. package/dist/ProfileSelector/index.d.ts.map +1 -1
  71. package/dist/ProfileSelector/index.js +727 -141
  72. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  73. package/dist/ProfileSource.js +230 -163
  74. package/dist/ProfileTypeSelector/index.js +214 -125
  75. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  76. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  77. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
  78. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  79. package/dist/ProfileView/components/ColorStackLegend.js +185 -55
  80. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  81. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  82. package/dist/ProfileView/components/DiffLegend.js +172 -29
  83. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  84. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  85. package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
  86. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  87. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  88. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  89. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
  90. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  91. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
  92. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  93. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  94. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  95. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  96. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
  97. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  98. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  99. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
  100. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  101. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  102. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  103. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  104. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  105. package/dist/ProfileView/components/ViewSelector/index.js +212 -86
  106. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  107. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  108. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  109. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  110. package/dist/ProfileView/context/DashboardContext.js +85 -29
  111. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  112. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  113. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  114. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  115. package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
  116. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  117. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  118. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  119. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
  120. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  121. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  122. package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
  123. package/dist/ProfileView/index.js +383 -45
  124. package/dist/ProfileView/types/visualization.js +1 -13
  125. package/dist/ProfileView/utils/colorUtils.js +8 -7
  126. package/dist/ProfileViewWithData.d.ts.map +1 -1
  127. package/dist/ProfileViewWithData.js +332 -228
  128. package/dist/QueryControls/index.js +418 -47
  129. package/dist/Sandwich/components/CalleesSection.js +54 -4
  130. package/dist/Sandwich/components/CallersSection.js +97 -27
  131. package/dist/Sandwich/components/TableSection.js +77 -4
  132. package/dist/Sandwich/index.d.ts.map +1 -1
  133. package/dist/Sandwich/index.js +126 -14
  134. package/dist/Sandwich/utils/processRowData.js +48 -39
  135. package/dist/SelectWithRefresh/index.js +102 -28
  136. package/dist/SimpleMatchers/Select.js +520 -187
  137. package/dist/SimpleMatchers/index.js +590 -288
  138. package/dist/SourceView/Highlighter.js +230 -70
  139. package/dist/SourceView/LineNo.js +72 -17
  140. package/dist/SourceView/index.d.ts.map +1 -1
  141. package/dist/SourceView/index.js +178 -104
  142. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  143. package/dist/SourceView/lang-detector/index.js +28 -14
  144. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  145. package/dist/SourceView/useSelectedLineRange.js +99 -23
  146. package/dist/Table/ColorCell.js +42 -1
  147. package/dist/Table/ColumnsVisibility.js +114 -6
  148. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  149. package/dist/Table/MoreDropdown.js +122 -25
  150. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  151. package/dist/Table/TableContextMenu.js +151 -137
  152. package/dist/Table/TableContextMenuWrapper.js +59 -14
  153. package/dist/Table/hooks/useColorManagement.js +58 -16
  154. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  155. package/dist/Table/hooks/useTableConfiguration.js +333 -169
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +222 -128
  158. package/dist/Table/utils/functions.js +169 -144
  159. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  160. package/dist/TimelineGuide/index.js +209 -16
  161. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  162. package/dist/TopTable/index.d.ts.map +1 -1
  163. package/dist/TopTable/index.js +342 -123
  164. package/dist/contexts/LabelsQueryProvider.js +94 -32
  165. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  166. package/dist/contexts/utils.js +37 -15
  167. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  168. package/dist/hooks/useCompareModeMeta.js +158 -64
  169. package/dist/hooks/useLabels.js +295 -52
  170. package/dist/hooks/useQueryState.d.ts +3 -3
  171. package/dist/hooks/useQueryState.d.ts.map +1 -1
  172. package/dist/hooks/useQueryState.js +373 -332
  173. package/dist/index.d.ts +2 -3
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +22 -8
  176. package/dist/testdata/fg-diff.json +3750 -0
  177. package/dist/testdata/fg-simple.json +1879 -0
  178. package/dist/testdata/link_data.json +56 -0
  179. package/dist/testdata/tabular.json +30 -0
  180. package/dist/testdata/test_flamegraph.json +26846 -0
  181. package/dist/testdata/test_graph.json +53 -0
  182. package/dist/useDelayedLoader.js +32 -18
  183. package/dist/useGrpcQuery/index.js +71 -11
  184. package/dist/useHasProfileData.js +90 -12
  185. package/dist/useQuery.js +205 -64
  186. package/dist/useSumBy.d.ts +1 -1
  187. package/dist/useSumBy.d.ts.map +1 -1
  188. package/dist/useSumBy.js +294 -138
  189. package/dist/utils.js +62 -30
  190. package/package.json +9 -10
  191. package/src/GraphTooltipArrow/index.tsx +3 -0
  192. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
  193. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  194. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  195. package/src/MatchersInput/index.tsx +1 -1
  196. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  197. package/src/PreSelectedMatchers/index.tsx +3 -0
  198. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
  199. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  200. package/src/ProfileFlameChart/index.tsx +28 -21
  201. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
  202. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
  203. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  204. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  205. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  206. package/src/ProfileFlameGraph/index.tsx +9 -6
  207. package/src/ProfileMetricsGraph/index.tsx +8 -6
  208. package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
  209. package/src/ProfileSelector/index.tsx +61 -39
  210. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
  211. package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
  212. package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
  213. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
  214. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  215. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
  216. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
  217. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  218. package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
  219. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  220. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  221. package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
  222. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
  223. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
  224. package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
  225. package/src/ProfileViewWithData.tsx +35 -29
  226. package/src/Sandwich/index.tsx +3 -4
  227. package/src/SourceView/index.tsx +2 -4
  228. package/src/SourceView/useSelectedLineRange.ts +19 -34
  229. package/src/Table/MoreDropdown.tsx +11 -9
  230. package/src/Table/TableContextMenu.tsx +13 -10
  231. package/src/Table/hooks/useTableConfiguration.tsx +11 -16
  232. package/src/Table/index.tsx +21 -12
  233. package/src/TopTable/index.tsx +4 -3
  234. package/src/hooks/useCompareModeMeta.ts +91 -61
  235. package/src/hooks/useQueryState.test.tsx +345 -275
  236. package/src/hooks/useQueryState.ts +118 -136
  237. package/src/index.tsx +15 -16
  238. package/src/useDelayedLoader.ts +10 -10
  239. package/src/useSumBy.ts +15 -21
  240. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  241. package/dist/hooks/urlParsers.d.ts +0 -18
  242. package/dist/hooks/urlParsers.d.ts.map +0 -1
  243. package/dist/hooks/urlParsers.js +0 -32
  244. package/dist/hooks/useColorBy.d.ts +0 -5
  245. package/dist/hooks/useColorBy.d.ts.map +0 -1
  246. package/dist/hooks/useColorBy.js +0 -26
  247. package/dist/hooks/useDashboardItems.d.ts +0 -5
  248. package/dist/hooks/useDashboardItems.d.ts.map +0 -1
  249. package/dist/hooks/useDashboardItems.js +0 -27
  250. package/dist/hooks/useQueryState.test.js +0 -868
  251. package/src/hooks/urlParsers.ts +0 -38
  252. package/src/hooks/useColorBy.ts +0 -42
  253. package/src/hooks/useDashboardItems.ts +0 -46
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react-compiler-runtime";
2
2
  // Copyright 2022 The Parca Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -11,22 +11,215 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
+
14
15
  import { Fragment } from 'react';
15
16
  import { scaleLinear, valueFormatter } from '@parca/utilities';
16
- const alignBeforeAxisCorrection = (val) => {
17
- if (val < 10000) {
18
- return -24;
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ var alignBeforeAxisCorrection = function alignBeforeAxisCorrection(val) {
19
+ if (val < 10000) {
20
+ return -24;
21
+ }
22
+ if (val < 100000) {
23
+ return -28;
24
+ }
25
+ return 0;
26
+ };
27
+ export var TimelineGuide = function TimelineGuide(t0) {
28
+ var $ = _c(48);
29
+ var bounds = t0.bounds,
30
+ width = t0.width,
31
+ height = t0.height,
32
+ margin = t0.margin,
33
+ ticks = t0.ticks,
34
+ t1 = t0.timeUnit,
35
+ t2 = t0.elevateGuideLines;
36
+ var timeUnit = t1 === undefined ? "milliseconds" : t1;
37
+ var elevateGuideLines = t2 === undefined ? false : t2;
38
+ var t10;
39
+ var t11;
40
+ var t12;
41
+ var t3;
42
+ var t4;
43
+ var t5;
44
+ var t6;
45
+ var t7;
46
+ var t8;
47
+ var t9;
48
+ if ($[0] !== bounds || $[1] !== elevateGuideLines || $[2] !== height || $[3] !== margin || $[4] !== ticks || $[5] !== timeUnit || $[6] !== width) {
49
+ var xScale = scaleLinear(bounds, [0, width]);
50
+ t12 = "relative h-5".concat(elevateGuideLines ? " z-40" : "");
51
+ t10 = "pointer-events-none absolute";
52
+ if ($[17] !== height || $[18] !== width) {
53
+ t11 = {
54
+ width: width,
55
+ height: height
56
+ };
57
+ $[17] = height;
58
+ $[18] = width;
59
+ $[19] = t11;
60
+ } else {
61
+ t11 = $[19];
19
62
  }
20
- if (val < 100000) {
21
- return -28;
63
+ if ($[20] === Symbol["for"]("react.memo_cache_sentinel")) {
64
+ t9 = {
65
+ width: "100%",
66
+ height: "100%"
67
+ };
68
+ $[20] = t9;
69
+ } else {
70
+ t9 = $[20];
22
71
  }
23
- return 0;
24
- };
25
- export const TimelineGuide = ({ bounds, width, height, margin, ticks, timeUnit = 'milliseconds', elevateGuideLines = false, }) => {
26
- const xScale = scaleLinear(bounds, [0, width]);
27
- return (_jsx("div", { className: `relative h-5${elevateGuideLines ? ' z-40' : ''}`, children: _jsx("div", { className: "pointer-events-none absolute", style: { width, height }, children: _jsx("svg", { style: { width: '100%', height: '100%' }, children: _jsxs("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: [xScale.ticks(ticks).map((d, i) => {
28
- return (_jsxs(Fragment, { children: [_jsx("g", { className: "tick",
29
- /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
30
- transform: `translate(${xScale(d) + alignBeforeAxisCorrection(d)}, ${-height})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: valueFormatter(d - bounds[0], timeUnit, 2, true).toString() }) }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`));
31
- }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: width, y1: -height + 1, y2: -height + 1 }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: width, y1: -height + 20, y2: -height + 20 })] }) }) }) }));
32
- };
72
+ t3 = "x axis";
73
+ t4 = "none";
74
+ t5 = "10";
75
+ t6 = "middle";
76
+ t7 = "translate(0,".concat(height - margin, ")");
77
+ t8 = xScale.ticks(ticks).map(function (d, i) {
78
+ return /*#__PURE__*/_jsxs(Fragment, {
79
+ children: [/*#__PURE__*/_jsx("g", {
80
+ className: "tick",
81
+ transform: "translate(".concat(xScale(d) + alignBeforeAxisCorrection(d), ", ").concat(-height, ")"),
82
+ children: /*#__PURE__*/_jsx("text", {
83
+ fill: "currentColor",
84
+ dy: ".71em",
85
+ y: 9,
86
+ children: valueFormatter(d - bounds[0], timeUnit, 2, true).toString()
87
+ })
88
+ }, "tick-".concat(i)), /*#__PURE__*/_jsx("g", {
89
+ children: /*#__PURE__*/_jsx("line", {
90
+ className: "stroke-gray-300 dark:stroke-gray-500",
91
+ x1: xScale(d),
92
+ x2: xScale(d),
93
+ y1: 0,
94
+ y2: -height + margin
95
+ })
96
+ }, "grid-".concat(i))]
97
+ }, "".concat(i.toString(), "-").concat(d.toString()));
98
+ });
99
+ $[0] = bounds;
100
+ $[1] = elevateGuideLines;
101
+ $[2] = height;
102
+ $[3] = margin;
103
+ $[4] = ticks;
104
+ $[5] = timeUnit;
105
+ $[6] = width;
106
+ $[7] = t10;
107
+ $[8] = t11;
108
+ $[9] = t12;
109
+ $[10] = t3;
110
+ $[11] = t4;
111
+ $[12] = t5;
112
+ $[13] = t6;
113
+ $[14] = t7;
114
+ $[15] = t8;
115
+ $[16] = t9;
116
+ } else {
117
+ t10 = $[7];
118
+ t11 = $[8];
119
+ t12 = $[9];
120
+ t3 = $[10];
121
+ t4 = $[11];
122
+ t5 = $[12];
123
+ t6 = $[13];
124
+ t7 = $[14];
125
+ t8 = $[15];
126
+ t9 = $[16];
127
+ }
128
+ var t13 = -height + 1;
129
+ var t14 = -height + 1;
130
+ var t15;
131
+ if ($[21] !== t13 || $[22] !== t14 || $[23] !== width) {
132
+ t15 = /*#__PURE__*/_jsx("line", {
133
+ className: "stroke-gray-300 dark:stroke-gray-500",
134
+ x1: 0,
135
+ x2: width,
136
+ y1: t13,
137
+ y2: t14
138
+ });
139
+ $[21] = t13;
140
+ $[22] = t14;
141
+ $[23] = width;
142
+ $[24] = t15;
143
+ } else {
144
+ t15 = $[24];
145
+ }
146
+ var t16 = -height + 20;
147
+ var t17 = -height + 20;
148
+ var t18;
149
+ if ($[25] !== t16 || $[26] !== t17 || $[27] !== width) {
150
+ t18 = /*#__PURE__*/_jsx("line", {
151
+ className: "stroke-gray-300 dark:stroke-gray-500",
152
+ x1: 0,
153
+ x2: width,
154
+ y1: t16,
155
+ y2: t17
156
+ });
157
+ $[25] = t16;
158
+ $[26] = t17;
159
+ $[27] = width;
160
+ $[28] = t18;
161
+ } else {
162
+ t18 = $[28];
163
+ }
164
+ var t19;
165
+ if ($[29] !== t15 || $[30] !== t18 || $[31] !== t3 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6 || $[35] !== t7 || $[36] !== t8) {
166
+ t19 = /*#__PURE__*/_jsxs("g", {
167
+ className: t3,
168
+ fill: t4,
169
+ fontSize: t5,
170
+ textAnchor: t6,
171
+ transform: t7,
172
+ children: [t8, t15, t18]
173
+ });
174
+ $[29] = t15;
175
+ $[30] = t18;
176
+ $[31] = t3;
177
+ $[32] = t4;
178
+ $[33] = t5;
179
+ $[34] = t6;
180
+ $[35] = t7;
181
+ $[36] = t8;
182
+ $[37] = t19;
183
+ } else {
184
+ t19 = $[37];
185
+ }
186
+ var t20;
187
+ if ($[38] !== t19 || $[39] !== t9) {
188
+ t20 = /*#__PURE__*/_jsx("svg", {
189
+ style: t9,
190
+ children: t19
191
+ });
192
+ $[38] = t19;
193
+ $[39] = t9;
194
+ $[40] = t20;
195
+ } else {
196
+ t20 = $[40];
197
+ }
198
+ var t21;
199
+ if ($[41] !== t10 || $[42] !== t11 || $[43] !== t20) {
200
+ t21 = /*#__PURE__*/_jsx("div", {
201
+ className: t10,
202
+ style: t11,
203
+ children: t20
204
+ });
205
+ $[41] = t10;
206
+ $[42] = t11;
207
+ $[43] = t20;
208
+ $[44] = t21;
209
+ } else {
210
+ t21 = $[44];
211
+ }
212
+ var t22;
213
+ if ($[45] !== t12 || $[46] !== t21) {
214
+ t22 = /*#__PURE__*/_jsx("div", {
215
+ className: t12,
216
+ children: t21
217
+ });
218
+ $[45] = t12;
219
+ $[46] = t21;
220
+ $[47] = t22;
221
+ } else {
222
+ t22 = $[47];
223
+ }
224
+ return t22;
225
+ };
@@ -0,0 +1,91 @@
1
+ // Copyright 2022 The Parca 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
+ const {GrpcWebFetchTransport} = require('@protobuf-ts/grpcweb-transport');
15
+ const client = require('@parca/client');
16
+ const fs = require('fs-extra');
17
+ const path = require('path');
18
+ // const {fileURLToPath} = require('url');
19
+ const fetch = require('node-fetch');
20
+
21
+ globalThis.fetch = fetch;
22
+ globalThis.Headers = fetch.Headers;
23
+ const DIR_NAME = __dirname; // path.dirname(fileURLToPath(import.meta.url));
24
+
25
+ const apiEndpoint = 'https://demo.parca.dev';
26
+
27
+ const queryClient = new client.QueryServiceClient(
28
+ new GrpcWebFetchTransport({
29
+ baseUrl: `${apiEndpoint}/api`,
30
+ })
31
+ );
32
+
33
+ const populateDataIfNeeded = async (from, filename) => {
34
+ const filePath = path.join(DIR_NAME, filename);
35
+ if (Object.keys(await readFile(filePath)).length > 0) {
36
+ return;
37
+ }
38
+ const {response} = await queryClient.query({
39
+ options: {
40
+ oneofKind: 'merge',
41
+ merge: {
42
+ start: client.Timestamp.fromDate(from),
43
+ end: client.Timestamp.fromDate(new Date()),
44
+ query: 'parca_agent_cpu:samples:count:cpu:nanoseconds:delta{container="parca"}',
45
+ },
46
+ },
47
+ reportType: client.QueryRequest_ReportType.TOP,
48
+ mode: client.QueryRequest_Mode.MERGE,
49
+ });
50
+ if (response.report.oneofKind !== 'top') {
51
+ throw new Error('Expected topTable report');
52
+ }
53
+ await writeToFile(response.report.top, filePath);
54
+ };
55
+
56
+ const writeToFile = async (data, filename) => {
57
+ await fs.createFile(filename);
58
+ return await fs.writeFile(filename, JSON.stringify(data));
59
+ };
60
+
61
+ const readFile = async filename => {
62
+ try {
63
+ return await fs.readJSON(filename);
64
+ } catch (e) {
65
+ return {};
66
+ }
67
+ };
68
+
69
+ const run = async () => {
70
+ await Promise.all([
71
+ populateDataIfNeeded(new Date(new Date().getTime() - 1000 * 60), 'parca-toptable-1m.json'),
72
+ populateDataIfNeeded(
73
+ new Date(new Date().getTime() - 1000 * 60 * 10),
74
+ 'parca-toptable-10m.json'
75
+ ),
76
+ populateDataIfNeeded(
77
+ new Date(new Date().getTime() - 1000 * 60 * 20),
78
+ 'parca-toptable-20m.json'
79
+ ),
80
+ ]);
81
+ };
82
+
83
+ run()
84
+ .then(() => {
85
+ console.log('done');
86
+ process.exit(0);
87
+ })
88
+ .catch(err => {
89
+ console.error('Error:', err);
90
+ process.exit(1);
91
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TopTable/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAC,GAAG,EAAW,WAAW,EAAC,MAAM,eAAe,CAAC;AAExD,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAM1B,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,QAAQ,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAcxD,CAAC;AAYF,eAAO,MAAM,QAAQ,2CA0KnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TopTable/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAC,GAAG,EAAW,WAAW,EAAC,MAAM,eAAe,CAAC;AAExD,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAK1B,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,QAAQ,GAAI,MAAM,WAAW,GAAG,SAAS,KAAG,MAcxD,CAAC;AAYF,eAAO,MAAM,QAAQ,2CA4KnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}