@flanksource/clicky-ui 0.3.48 → 0.3.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connections/ConnectionsPage.cjs +219 -0
- package/dist/connections/ConnectionsPage.cjs.map +1 -0
- package/dist/connections/ConnectionsPage.d.ts +23 -0
- package/dist/connections/ConnectionsPage.d.ts.map +1 -0
- package/dist/connections/ConnectionsPage.js +219 -0
- package/dist/connections/ConnectionsPage.js.map +1 -0
- package/dist/connections/connectionActionStatus.cjs +43 -0
- package/dist/connections/connectionActionStatus.cjs.map +1 -0
- package/dist/connections/connectionActionStatus.d.ts +5 -0
- package/dist/connections/connectionActionStatus.d.ts.map +1 -0
- package/dist/connections/connectionActionStatus.js +43 -0
- package/dist/connections/connectionActionStatus.js.map +1 -0
- package/dist/connections/connectionActionTypes.cjs +24 -0
- package/dist/connections/connectionActionTypes.cjs.map +1 -0
- package/dist/connections/connectionActionTypes.d.ts +36 -0
- package/dist/connections/connectionActionTypes.d.ts.map +1 -0
- package/dist/connections/connectionActionTypes.js +24 -0
- package/dist/connections/connectionActionTypes.js.map +1 -0
- package/dist/connections/connectionActions.cjs +11 -0
- package/dist/connections/connectionActions.cjs.map +1 -0
- package/dist/connections/connectionActions.d.ts +15 -0
- package/dist/connections/connectionActions.d.ts.map +1 -0
- package/dist/connections/connectionActions.js +11 -0
- package/dist/connections/connectionActions.js.map +1 -0
- package/dist/connections/connectionDashboard.cjs +185 -0
- package/dist/connections/connectionDashboard.cjs.map +1 -0
- package/dist/connections/connectionDashboard.d.ts +25 -0
- package/dist/connections/connectionDashboard.d.ts.map +1 -0
- package/dist/connections/connectionDashboard.js +185 -0
- package/dist/connections/connectionDashboard.js.map +1 -0
- package/dist/connections/connectionDashboardModel.cjs +43 -0
- package/dist/connections/connectionDashboardModel.cjs.map +1 -0
- package/dist/connections/connectionDashboardModel.d.ts +75 -0
- package/dist/connections/connectionDashboardModel.d.ts.map +1 -0
- package/dist/connections/connectionDashboardModel.js +43 -0
- package/dist/connections/connectionDashboardModel.js.map +1 -0
- package/dist/connections/connectionDashboardRenderer.cjs +21 -0
- package/dist/connections/connectionDashboardRenderer.cjs.map +1 -0
- package/dist/connections/connectionDashboardRenderer.d.ts +15 -0
- package/dist/connections/connectionDashboardRenderer.d.ts.map +1 -0
- package/dist/connections/connectionDashboardRenderer.js +21 -0
- package/dist/connections/connectionDashboardRenderer.js.map +1 -0
- package/dist/connections/connectionDashboardRow.cjs +169 -0
- package/dist/connections/connectionDashboardRow.cjs.map +1 -0
- package/dist/connections/connectionDashboardRow.d.ts +12 -0
- package/dist/connections/connectionDashboardRow.d.ts.map +1 -0
- package/dist/connections/connectionDashboardRow.js +169 -0
- package/dist/connections/connectionDashboardRow.js.map +1 -0
- package/dist/connections/connectionErrorView.cjs +8 -0
- package/dist/connections/connectionErrorView.cjs.map +1 -0
- package/dist/connections/connectionErrorView.d.ts +4 -0
- package/dist/connections/connectionErrorView.d.ts.map +1 -0
- package/dist/connections/connectionErrorView.js +8 -0
- package/dist/connections/connectionErrorView.js.map +1 -0
- package/dist/connections/connectionHealth.cjs +82 -0
- package/dist/connections/connectionHealth.cjs.map +1 -0
- package/dist/connections/connectionHealth.d.ts +33 -0
- package/dist/connections/connectionHealth.d.ts.map +1 -0
- package/dist/connections/connectionHealth.js +82 -0
- package/dist/connections/connectionHealth.js.map +1 -0
- package/dist/connections/connectionLogging.cjs +29 -0
- package/dist/connections/connectionLogging.cjs.map +1 -0
- package/dist/connections/connectionLogging.d.ts +11 -0
- package/dist/connections/connectionLogging.d.ts.map +1 -0
- package/dist/connections/connectionLogging.js +29 -0
- package/dist/connections/connectionLogging.js.map +1 -0
- package/dist/connections/connectionLoggingField.cjs +37 -0
- package/dist/connections/connectionLoggingField.cjs.map +1 -0
- package/dist/connections/connectionLoggingField.d.ts +12 -0
- package/dist/connections/connectionLoggingField.d.ts.map +1 -0
- package/dist/connections/connectionLoggingField.js +37 -0
- package/dist/connections/connectionLoggingField.js.map +1 -0
- package/dist/connections/connectionLoggingModel.cjs +16 -0
- package/dist/connections/connectionLoggingModel.cjs.map +1 -0
- package/dist/connections/connectionLoggingModel.d.ts +6 -0
- package/dist/connections/connectionLoggingModel.d.ts.map +1 -0
- package/dist/connections/connectionLoggingModel.js +16 -0
- package/dist/connections/connectionLoggingModel.js.map +1 -0
- package/dist/connections/connectionResolveView.cjs +24 -0
- package/dist/connections/connectionResolveView.cjs.map +1 -0
- package/dist/connections/connectionResolveView.d.ts +5 -0
- package/dist/connections/connectionResolveView.d.ts.map +1 -0
- package/dist/connections/connectionResolveView.js +24 -0
- package/dist/connections/connectionResolveView.js.map +1 -0
- package/dist/connections/connectionTestButton.cjs +58 -0
- package/dist/connections/connectionTestButton.cjs.map +1 -0
- package/dist/connections/connectionTestButton.d.ts +6 -0
- package/dist/connections/connectionTestButton.d.ts.map +1 -0
- package/dist/connections/connectionTestButton.js +58 -0
- package/dist/connections/connectionTestButton.js.map +1 -0
- package/dist/connections/connectionTestView.cjs +12 -0
- package/dist/connections/connectionTestView.cjs.map +1 -0
- package/dist/connections/connectionTestView.d.ts +5 -0
- package/dist/connections/connectionTestView.d.ts.map +1 -0
- package/dist/connections/connectionTestView.js +12 -0
- package/dist/connections/connectionTestView.js.map +1 -0
- package/dist/connections/connectionsPageModel.cjs +33 -0
- package/dist/connections/connectionsPageModel.cjs.map +1 -0
- package/dist/connections/connectionsPageModel.d.ts +24 -0
- package/dist/connections/connectionsPageModel.d.ts.map +1 -0
- package/dist/connections/connectionsPageModel.js +33 -0
- package/dist/connections/connectionsPageModel.js.map +1 -0
- package/dist/connections/iconProvider.cjs +20 -0
- package/dist/connections/iconProvider.cjs.map +1 -0
- package/dist/connections/iconProvider.d.ts +7 -0
- package/dist/connections/iconProvider.d.ts.map +1 -0
- package/dist/connections/iconProvider.js +20 -0
- package/dist/connections/iconProvider.js.map +1 -0
- package/dist/connections.cjs +45 -0
- package/dist/connections.cjs.map +1 -0
- package/dist/connections.d.ts +34 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +45 -0
- package/dist/connections.js.map +1 -0
- package/dist/data/DataTable.cjs +18 -8
- package/dist/data/DataTable.cjs.map +1 -1
- package/dist/data/DataTable.d.ts +4 -0
- package/dist/data/DataTable.d.ts.map +1 -1
- package/dist/data/DataTable.js +18 -8
- package/dist/data/DataTable.js.map +1 -1
- package/dist/data/TaskManager.cjs +183 -159
- package/dist/data/TaskManager.cjs.map +1 -1
- package/dist/data/TaskManager.d.ts +3 -1
- package/dist/data/TaskManager.d.ts.map +1 -1
- package/dist/data/TaskManager.js +185 -161
- package/dist/data/TaskManager.js.map +1 -1
- package/dist/data/TaskManagerButton.cjs +1 -0
- package/dist/data/TaskManagerButton.cjs.map +1 -1
- package/dist/data/TaskManagerButton.js +1 -0
- package/dist/data/TaskManagerButton.js.map +1 -1
- package/dist/data/TaskProgress.cjs +13 -7
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.d.ts +3 -1
- package/dist/data/TaskProgress.d.ts.map +1 -1
- package/dist/data/TaskProgress.js +13 -7
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/diagnostics/DiagnosticsDetailPanel.cjs +52 -295
- package/dist/data/diagnostics/DiagnosticsDetailPanel.cjs.map +1 -1
- package/dist/data/diagnostics/DiagnosticsDetailPanel.d.ts.map +1 -1
- package/dist/data/diagnostics/DiagnosticsDetailPanel.js +47 -290
- package/dist/data/diagnostics/DiagnosticsDetailPanel.js.map +1 -1
- package/dist/data/diagnostics/MetricTile.cjs +44 -0
- package/dist/data/diagnostics/MetricTile.cjs.map +1 -0
- package/dist/data/diagnostics/MetricTile.d.ts +13 -0
- package/dist/data/diagnostics/MetricTile.d.ts.map +1 -0
- package/dist/data/diagnostics/MetricTile.js +44 -0
- package/dist/data/diagnostics/MetricTile.js.map +1 -0
- package/dist/data/diagnostics/StackDumpView.cjs +227 -0
- package/dist/data/diagnostics/StackDumpView.cjs.map +1 -0
- package/dist/data/diagnostics/StackDumpView.d.ts +53 -0
- package/dist/data/diagnostics/StackDumpView.d.ts.map +1 -0
- package/dist/data/diagnostics/StackDumpView.js +227 -0
- package/dist/data/diagnostics/StackDumpView.js.map +1 -0
- package/dist/data/diagnostics/fixtures.d.ts +1 -0
- package/dist/data/diagnostics/fixtures.d.ts.map +1 -1
- package/dist/data/diagnostics/metric-tone.cjs +18 -0
- package/dist/data/diagnostics/metric-tone.cjs.map +1 -0
- package/dist/data/diagnostics/metric-tone.d.ts +6 -0
- package/dist/data/diagnostics/metric-tone.d.ts.map +1 -0
- package/dist/data/diagnostics/metric-tone.js +18 -0
- package/dist/data/diagnostics/metric-tone.js.map +1 -0
- package/dist/data/diagnostics/stacktrace.cjs +44 -0
- package/dist/data/diagnostics/stacktrace.cjs.map +1 -1
- package/dist/data/diagnostics/stacktrace.d.ts +7 -0
- package/dist/data/diagnostics/stacktrace.d.ts.map +1 -1
- package/dist/data/diagnostics/stacktrace.js +44 -0
- package/dist/data/diagnostics/stacktrace.js.map +1 -1
- package/dist/data/diagnostics/types.d.ts +2 -8
- package/dist/data/diagnostics/types.d.ts.map +1 -1
- package/dist/data/lint/LintDetail.cjs +339 -0
- package/dist/data/lint/LintDetail.cjs.map +1 -0
- package/dist/data/lint/LintDetail.d.ts +17 -0
- package/dist/data/lint/LintDetail.d.ts.map +1 -0
- package/dist/data/lint/LintDetail.js +339 -0
- package/dist/data/lint/LintDetail.js.map +1 -0
- package/dist/data/lint/LintFilterBar.cjs +103 -0
- package/dist/data/lint/LintFilterBar.cjs.map +1 -0
- package/dist/data/lint/LintFilterBar.d.ts +16 -0
- package/dist/data/lint/LintFilterBar.d.ts.map +1 -0
- package/dist/data/lint/LintFilterBar.js +103 -0
- package/dist/data/lint/LintFilterBar.js.map +1 -0
- package/dist/data/lint/LintResults.cjs +144 -0
- package/dist/data/lint/LintResults.cjs.map +1 -0
- package/dist/data/lint/LintResults.d.ts +39 -0
- package/dist/data/lint/LintResults.d.ts.map +1 -0
- package/dist/data/lint/LintResults.fixtures.d.ts +10 -0
- package/dist/data/lint/LintResults.fixtures.d.ts.map +1 -0
- package/dist/data/lint/LintResults.js +144 -0
- package/dist/data/lint/LintResults.js.map +1 -0
- package/dist/data/lint/LintTreeNode.cjs +66 -0
- package/dist/data/lint/LintTreeNode.cjs.map +1 -0
- package/dist/data/lint/LintTreeNode.d.ts +7 -0
- package/dist/data/lint/LintTreeNode.d.ts.map +1 -0
- package/dist/data/lint/LintTreeNode.js +66 -0
- package/dist/data/lint/LintTreeNode.js.map +1 -0
- package/dist/data/lint/actions.cjs +195 -0
- package/dist/data/lint/actions.cjs.map +1 -0
- package/dist/data/lint/actions.d.ts +29 -0
- package/dist/data/lint/actions.d.ts.map +1 -0
- package/dist/data/lint/actions.js +195 -0
- package/dist/data/lint/actions.js.map +1 -0
- package/dist/data/lint/grouping-options.cjs +14 -0
- package/dist/data/lint/grouping-options.cjs.map +1 -0
- package/dist/data/lint/grouping-options.d.ts +9 -0
- package/dist/data/lint/grouping-options.d.ts.map +1 -0
- package/dist/data/lint/grouping-options.js +14 -0
- package/dist/data/lint/grouping-options.js.map +1 -0
- package/dist/data/lint/grouping.cjs +450 -0
- package/dist/data/lint/grouping.cjs.map +1 -0
- package/dist/data/lint/grouping.d.ts +10 -0
- package/dist/data/lint/grouping.d.ts.map +1 -0
- package/dist/data/lint/grouping.js +450 -0
- package/dist/data/lint/grouping.js.map +1 -0
- package/dist/data/lint/index.d.ts +10 -0
- package/dist/data/lint/index.d.ts.map +1 -0
- package/dist/data/lint/paths.cjs +35 -0
- package/dist/data/lint/paths.cjs.map +1 -0
- package/dist/data/lint/paths.d.ts +13 -0
- package/dist/data/lint/paths.d.ts.map +1 -0
- package/dist/data/lint/paths.js +35 -0
- package/dist/data/lint/paths.js.map +1 -0
- package/dist/data/lint/stats.cjs +76 -0
- package/dist/data/lint/stats.cjs.map +1 -0
- package/dist/data/lint/stats.d.ts +19 -0
- package/dist/data/lint/stats.d.ts.map +1 -0
- package/dist/data/lint/stats.js +76 -0
- package/dist/data/lint/stats.js.map +1 -0
- package/dist/data/lint/types.cjs +16 -0
- package/dist/data/lint/types.cjs.map +1 -0
- package/dist/data/lint/types.d.ts +93 -0
- package/dist/data/lint/types.d.ts.map +1 -0
- package/dist/data/lint/types.js +16 -0
- package/dist/data/lint/types.js.map +1 -0
- package/dist/data/test-runner/TestAttemptDetail.cjs +113 -0
- package/dist/data/test-runner/TestAttemptDetail.cjs.map +1 -0
- package/dist/data/test-runner/TestAttemptDetail.d.ts +19 -0
- package/dist/data/test-runner/TestAttemptDetail.d.ts.map +1 -0
- package/dist/data/test-runner/TestAttemptDetail.js +113 -0
- package/dist/data/test-runner/TestAttemptDetail.js.map +1 -0
- package/dist/data/test-runner/TestAttempts.cjs +36 -0
- package/dist/data/test-runner/TestAttempts.cjs.map +1 -0
- package/dist/data/test-runner/TestAttempts.d.ts +5 -0
- package/dist/data/test-runner/TestAttempts.d.ts.map +1 -0
- package/dist/data/test-runner/TestAttempts.js +36 -0
- package/dist/data/test-runner/TestAttempts.js.map +1 -0
- package/dist/data/test-runner/TestDetailPanel.cjs +13 -3
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +14 -4
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.cjs +9 -29
- package/dist/data/test-runner/TestFailureDetail.cjs.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.d.ts +6 -6
- package/dist/data/test-runner/TestFailureDetail.d.ts.map +1 -1
- package/dist/data/test-runner/TestFailureDetail.js +9 -29
- package/dist/data/test-runner/TestFailureDetail.js.map +1 -1
- package/dist/data/test-runner/TestRunSummary.cjs +33 -0
- package/dist/data/test-runner/TestRunSummary.cjs.map +1 -1
- package/dist/data/test-runner/TestRunSummary.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunSummary.js +34 -1
- package/dist/data/test-runner/TestRunSummary.js.map +1 -1
- package/dist/data/test-runner/TestRunner.cjs +3 -0
- package/dist/data/test-runner/TestRunner.cjs.map +1 -1
- package/dist/data/test-runner/TestRunner.d.ts +8 -1
- package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunner.js +3 -0
- package/dist/data/test-runner/TestRunner.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +3 -1
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +3 -1
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/adapter.cjs +9 -1
- package/dist/data/test-runner/adapter.cjs.map +1 -1
- package/dist/data/test-runner/adapter.d.ts +5 -0
- package/dist/data/test-runner/adapter.d.ts.map +1 -1
- package/dist/data/test-runner/adapter.js +9 -1
- package/dist/data/test-runner/adapter.js.map +1 -1
- package/dist/data/test-runner/attempts.cjs +62 -0
- package/dist/data/test-runner/attempts.cjs.map +1 -0
- package/dist/data/test-runner/attempts.d.ts +13 -0
- package/dist/data/test-runner/attempts.d.ts.map +1 -0
- package/dist/data/test-runner/attempts.js +62 -0
- package/dist/data/test-runner/attempts.js.map +1 -0
- package/dist/data/test-runner/context.cjs.map +1 -1
- package/dist/data/test-runner/context.d.ts +6 -0
- package/dist/data/test-runner/context.d.ts.map +1 -1
- package/dist/data/test-runner/context.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +5 -1
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/test-runner/marks.cjs +2 -0
- package/dist/data/test-runner/marks.cjs.map +1 -1
- package/dist/data/test-runner/marks.d.ts.map +1 -1
- package/dist/data/test-runner/marks.js +2 -0
- package/dist/data/test-runner/marks.js.map +1 -1
- package/dist/data/test-runner/process-metrics.cjs +15 -0
- package/dist/data/test-runner/process-metrics.cjs.map +1 -0
- package/dist/data/test-runner/process-metrics.d.ts +22 -0
- package/dist/data/test-runner/process-metrics.d.ts.map +1 -0
- package/dist/data/test-runner/process-metrics.js +15 -0
- package/dist/data/test-runner/process-metrics.js.map +1 -0
- package/dist/data/test-runner/status.cjs +11 -3
- package/dist/data/test-runner/status.cjs.map +1 -1
- package/dist/data/test-runner/status.d.ts +3 -1
- package/dist/data/test-runner/status.d.ts.map +1 -1
- package/dist/data/test-runner/status.js +11 -3
- package/dist/data/test-runner/status.js.map +1 -1
- package/dist/data/test-runner/types.d.ts +14 -0
- package/dist/data/test-runner/types.d.ts.map +1 -1
- package/dist/data/traces/GoProfileView.cjs +176 -0
- package/dist/data/traces/GoProfileView.cjs.map +1 -0
- package/dist/data/traces/GoProfileView.d.ts +30 -0
- package/dist/data/traces/GoProfileView.d.ts.map +1 -0
- package/dist/data/traces/GoProfileView.js +176 -0
- package/dist/data/traces/GoProfileView.js.map +1 -0
- package/dist/data/traces/ProcessFacetTable.cjs +79 -0
- package/dist/data/traces/ProcessFacetTable.cjs.map +1 -0
- package/dist/data/traces/ProcessFacetTable.d.ts +21 -0
- package/dist/data/traces/ProcessFacetTable.d.ts.map +1 -0
- package/dist/data/traces/ProcessFacetTable.js +79 -0
- package/dist/data/traces/ProcessFacetTable.js.map +1 -0
- package/dist/data/traces/ProcessRecordViews.cjs +41 -0
- package/dist/data/traces/ProcessRecordViews.cjs.map +1 -0
- package/dist/data/traces/ProcessRecordViews.d.ts +16 -0
- package/dist/data/traces/ProcessRecordViews.d.ts.map +1 -0
- package/dist/data/traces/ProcessRecordViews.js +41 -0
- package/dist/data/traces/ProcessRecordViews.js.map +1 -0
- package/dist/data/traces/ProcessTraceDetail.cjs +316 -0
- package/dist/data/traces/ProcessTraceDetail.cjs.map +1 -0
- package/dist/data/traces/ProcessTraceDetail.d.ts +39 -0
- package/dist/data/traces/ProcessTraceDetail.d.ts.map +1 -0
- package/dist/data/traces/ProcessTraceDetail.js +316 -0
- package/dist/data/traces/ProcessTraceDetail.js.map +1 -0
- package/dist/data/traces/ProcessTraceTree.cjs +135 -0
- package/dist/data/traces/ProcessTraceTree.cjs.map +1 -0
- package/dist/data/traces/ProcessTraceTree.d.ts +41 -0
- package/dist/data/traces/ProcessTraceTree.d.ts.map +1 -0
- package/dist/data/traces/ProcessTraceTree.js +135 -0
- package/dist/data/traces/ProcessTraceTree.js.map +1 -0
- package/dist/data/traces/Sparkline.cjs +45 -0
- package/dist/data/traces/Sparkline.cjs.map +1 -0
- package/dist/data/traces/Sparkline.d.ts +29 -0
- package/dist/data/traces/Sparkline.d.ts.map +1 -0
- package/dist/data/traces/Sparkline.js +45 -0
- package/dist/data/traces/Sparkline.js.map +1 -0
- package/dist/data/traces/SqlTraceTable.cjs +104 -0
- package/dist/data/traces/SqlTraceTable.cjs.map +1 -0
- package/dist/data/traces/SqlTraceTable.d.ts +19 -0
- package/dist/data/traces/SqlTraceTable.d.ts.map +1 -0
- package/dist/data/traces/SqlTraceTable.js +104 -0
- package/dist/data/traces/SqlTraceTable.js.map +1 -0
- package/dist/data/traces/TerminalCastPlayer.cjs +162 -0
- package/dist/data/traces/TerminalCastPlayer.cjs.map +1 -0
- package/dist/data/traces/TerminalCastPlayer.js +162 -0
- package/dist/data/traces/TerminalCastPlayer.js.map +1 -0
- package/dist/data/traces/TraceHarView.cjs +15 -0
- package/dist/data/traces/TraceHarView.cjs.map +1 -0
- package/dist/data/traces/TraceHarView.js +15 -0
- package/dist/data/traces/TraceHarView.js.map +1 -0
- package/dist/data/traces/TraceView.cjs +63 -0
- package/dist/data/traces/TraceView.cjs.map +1 -0
- package/dist/data/traces/TraceView.d.ts +20 -0
- package/dist/data/traces/TraceView.d.ts.map +1 -0
- package/dist/data/traces/TraceView.js +63 -0
- package/dist/data/traces/TraceView.js.map +1 -0
- package/dist/data/traces/TraceWindowList.cjs +117 -0
- package/dist/data/traces/TraceWindowList.cjs.map +1 -0
- package/dist/data/traces/TraceWindowList.d.ts +48 -0
- package/dist/data/traces/TraceWindowList.d.ts.map +1 -0
- package/dist/data/traces/TraceWindowList.js +117 -0
- package/dist/data/traces/TraceWindowList.js.map +1 -0
- package/dist/data/traces/cast.cjs +81 -0
- package/dist/data/traces/cast.cjs.map +1 -0
- package/dist/data/traces/cast.js +81 -0
- package/dist/data/traces/cast.js.map +1 -0
- package/dist/data/traces/fixtures.d.ts +25 -1
- package/dist/data/traces/fixtures.d.ts.map +1 -1
- package/dist/data/traces/har-adapter.cjs +83 -0
- package/dist/data/traces/har-adapter.cjs.map +1 -0
- package/dist/data/traces/har-adapter.js +83 -0
- package/dist/data/traces/har-adapter.js.map +1 -0
- package/dist/data/traces/index.d.ts +19 -0
- package/dist/data/traces/index.d.ts.map +1 -0
- package/dist/data/traces/process-facets.cjs +48 -0
- package/dist/data/traces/process-facets.cjs.map +1 -0
- package/dist/data/traces/process-facets.d.ts +38 -0
- package/dist/data/traces/process-facets.d.ts.map +1 -0
- package/dist/data/traces/process-facets.js +48 -0
- package/dist/data/traces/process-facets.js.map +1 -0
- package/dist/data/traces/process-tree.cjs +85 -0
- package/dist/data/traces/process-tree.cjs.map +1 -0
- package/dist/data/traces/process-tree.d.ts +40 -0
- package/dist/data/traces/process-tree.d.ts.map +1 -0
- package/dist/data/traces/process-tree.js +85 -0
- package/dist/data/traces/process-tree.js.map +1 -0
- package/dist/data/traces/profile-aggregate.cjs +78 -0
- package/dist/data/traces/profile-aggregate.cjs.map +1 -0
- package/dist/data/traces/profile-aggregate.d.ts +41 -0
- package/dist/data/traces/profile-aggregate.d.ts.map +1 -0
- package/dist/data/traces/profile-aggregate.js +78 -0
- package/dist/data/traces/profile-aggregate.js.map +1 -0
- package/dist/data/traces/sql-trace.cjs +39 -0
- package/dist/data/traces/sql-trace.cjs.map +1 -0
- package/dist/data/traces/sql-trace.d.ts +31 -0
- package/dist/data/traces/sql-trace.d.ts.map +1 -0
- package/dist/data/traces/sql-trace.js +39 -0
- package/dist/data/traces/sql-trace.js.map +1 -0
- package/dist/data/traces/stack-checkpoints.cjs +22 -0
- package/dist/data/traces/stack-checkpoints.cjs.map +1 -0
- package/dist/data/traces/stack-checkpoints.d.ts +18 -0
- package/dist/data/traces/stack-checkpoints.d.ts.map +1 -0
- package/dist/data/traces/stack-checkpoints.js +22 -0
- package/dist/data/traces/stack-checkpoints.js.map +1 -0
- package/dist/data/traces/terminal-screen.cjs +270 -0
- package/dist/data/traces/terminal-screen.cjs.map +1 -0
- package/dist/data/traces/terminal-screen.js +270 -0
- package/dist/data/traces/terminal-screen.js.map +1 -0
- package/dist/data/traces/terminal-timeline.cjs +48 -0
- package/dist/data/traces/terminal-timeline.cjs.map +1 -0
- package/dist/data/traces/terminal-timeline.js +48 -0
- package/dist/data/traces/terminal-timeline.js.map +1 -0
- package/dist/data/traces/types.d.ts +121 -8
- package/dist/data/traces/types.d.ts.map +1 -1
- package/dist/data/verification/adapters.cjs +1 -0
- package/dist/data/verification/adapters.cjs.map +1 -1
- package/dist/data/verification/adapters.d.ts.map +1 -1
- package/dist/data/verification/adapters.js +1 -0
- package/dist/data/verification/adapters.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.cjs.map +1 -1
- package/dist/data/version-info.js +3 -3
- package/dist/data/version-info.js.map +1 -1
- package/dist/data.cjs +105 -5
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +5 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +101 -1
- package/dist/data.js.map +1 -1
- package/dist/index.cjs +107 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree.cjs","sources":["../../../src/data/traces/process-tree.ts"],"sourcesContent":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/**\n * Drops exited processes from a forest, keeping an exited process only while it\n * still has a live descendant to hang off. Returns new nodes; the input is not\n * modified.\n */\nexport function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n return roots.flatMap((node) => {\n const children = pruneExitedProcesses(node.children);\n return node.exited && children.length === 0 ? [] : [{ ...node, children }];\n });\n}\n\n/** How long the process lived: to its exit, else to the last time it was seen. */\nexport function processLifetimeMs(row: ProcessNodeRow): number {\n return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);\n}\n\n/** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */\nexport function formatProcessTimestamp(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n}\n\n/** The process has exited: by its status, or because an exit time was recorded. */\nexport function isProcessExited(row: ProcessNodeRow): boolean {\n return row.status === \"exited\" || Boolean(row.exitedAt);\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** A CPU % for display, \"—\" while it is still unknown. */\nexport function formatCpuPercent(value: number | null | undefined): string {\n return value == null ? \"—\" : `${value.toFixed(1)}%`;\n}\n\nfunction knownCpu(samples: ProcessSampleRow[]): number[] {\n return samples.flatMap((sample) => (sample.cpuPercent == null ? [] : [sample.cpuPercent]));\n}\n\n/** Each process's known CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));\n}\n\n/** One process's known CPU % and RSS bytes over its samples, in tick order. */\nexport function processSeries(samples: ProcessSampleRow[], key: string): { cpu: number[]; rss: number[] } {\n const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values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AAK,CAAC,OAAO,UAAU,CAAE;AAC3F;AAGO,SAAS,eAAe,SAAoD;AACjF,QAAM,4BAAY,IAAA;AAClB,aAAW,UAAU,QAAS,OAAM,IAAI,OAAO,KAAK,CAAC,GAAI,MAAM,IAAI,OAAO,GAAG,KAAK,CAAA,GAAK,MAAM,CAAC;AAC9F,SAAO,IAAI,IAAI,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,SAAS,KAAK,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACvG;AAGO,SAAS,cAAc,SAA6B,KAA+C;AACxG,QAAM,MAAM,QAAQ,OAAO,CAAC,WAAW,OAAO,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;AACzF,SAAO,EAAE,KAAK,SAAS,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,WAAW,OAAO,QAAQ,EAAA;AACvE;AAGO,SAAS,gBAAgB,QAAkB,OAAe,QAAoC;AACnG,MAAI,OAAO,SAAS,EAAG,QAAO;AAC9B,QAAM,MAAM,KAAK,IAAI,GAAG,MAAM;AAC9B,SAAO,OACJ,IAAI,CAAC,OAAO,UAAU;AACrB,UAAM,IAAK,SAAS,OAAO,SAAS,KAAM;AAC1C,UAAM,IAAI,QAAQ,IAAI,SAAS,SAAU,QAAQ,MAAO;AACxD,WAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAAA,EACxC,CAAC,EACA,KAAK,GAAG;AACb;;;;;;;;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProcessNodeRow, ProcessSampleRow } from './types.js';
|
|
2
|
+
export type ProcessTreeNode = {
|
|
3
|
+
row: ProcessNodeRow;
|
|
4
|
+
children: ProcessTreeNode[];
|
|
5
|
+
/** The process has exited: by its status, or because an exit time was recorded. */
|
|
6
|
+
exited: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Builds the forest a `process_tree` stream describes: each row under its
|
|
10
|
+
* `parentKey`. A row whose parent was never recorded (the capture began below
|
|
11
|
+
* it) becomes a root. The stream holds each process once, so a repeated key or a
|
|
12
|
+
* parent cycle is a corrupt capture and throws.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[];
|
|
15
|
+
/**
|
|
16
|
+
* Drops exited processes from a forest, keeping an exited process only while it
|
|
17
|
+
* still has a live descendant to hang off. Returns new nodes; the input is not
|
|
18
|
+
* modified.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[];
|
|
21
|
+
/** How long the process lived: to its exit, else to the last time it was seen. */
|
|
22
|
+
export declare function processLifetimeMs(row: ProcessNodeRow): number;
|
|
23
|
+
/** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */
|
|
24
|
+
export declare function formatProcessTimestamp(iso: string): string;
|
|
25
|
+
/** The process has exited: by its status, or because an exit time was recorded. */
|
|
26
|
+
export declare function isProcessExited(row: ProcessNodeRow): boolean;
|
|
27
|
+
/** The forest depth-first, parents before children. */
|
|
28
|
+
export declare function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[];
|
|
29
|
+
/** A CPU % for display, "—" while it is still unknown. */
|
|
30
|
+
export declare function formatCpuPercent(value: number | null | undefined): string;
|
|
31
|
+
/** Each process's known CPU % over its samples, in tick order. */
|
|
32
|
+
export declare function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]>;
|
|
33
|
+
/** One process's known CPU % and RSS bytes over its samples, in tick order. */
|
|
34
|
+
export declare function processSeries(samples: ProcessSampleRow[], key: string): {
|
|
35
|
+
cpu: number[];
|
|
36
|
+
rss: number[];
|
|
37
|
+
};
|
|
38
|
+
/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */
|
|
39
|
+
export declare function sparklinePoints(values: number[], width: number, height: number): string | undefined;
|
|
40
|
+
//# sourceMappingURL=process-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree.d.ts","sourceRoot":"","sources":["../../../src/data/traces/process-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,eAAe,EAAE,CAqB5E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAKhF;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAE7D;AAED,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAE5D;AAED,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAQzE;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEzE;AAMD,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAIjF;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAGxG;AAED,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const byStart = (a, b) => Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;
|
|
2
|
+
function buildProcessForest(rows) {
|
|
3
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const row of rows) {
|
|
5
|
+
if (nodes.has(row.key)) throw new Error(`process tree key "${row.key}" appears twice`);
|
|
6
|
+
nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });
|
|
7
|
+
}
|
|
8
|
+
const roots = [];
|
|
9
|
+
for (const node of nodes.values()) {
|
|
10
|
+
const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : void 0;
|
|
11
|
+
(parent ? parent.children : roots).push(node);
|
|
12
|
+
}
|
|
13
|
+
roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));
|
|
14
|
+
const reached = flattenForest(roots);
|
|
15
|
+
if (reached.length !== nodes.size) {
|
|
16
|
+
const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));
|
|
17
|
+
throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `"${key}"`).join(", ")}`);
|
|
18
|
+
}
|
|
19
|
+
for (const node of nodes.values()) node.children.sort(byStart);
|
|
20
|
+
return roots;
|
|
21
|
+
}
|
|
22
|
+
function pruneExitedProcesses(roots) {
|
|
23
|
+
return roots.flatMap((node) => {
|
|
24
|
+
const children = pruneExitedProcesses(node.children);
|
|
25
|
+
return node.exited && children.length === 0 ? [] : [{ ...node, children }];
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function processLifetimeMs(row) {
|
|
29
|
+
return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);
|
|
30
|
+
}
|
|
31
|
+
function formatProcessTimestamp(iso) {
|
|
32
|
+
const date = new Date(iso);
|
|
33
|
+
if (Number.isNaN(date.getTime())) return iso;
|
|
34
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
35
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
36
|
+
}
|
|
37
|
+
function isProcessExited(row) {
|
|
38
|
+
return row.status === "exited" || Boolean(row.exitedAt);
|
|
39
|
+
}
|
|
40
|
+
function flattenForest(roots) {
|
|
41
|
+
const flat = [];
|
|
42
|
+
const visit = (node) => {
|
|
43
|
+
flat.push(node);
|
|
44
|
+
node.children.forEach(visit);
|
|
45
|
+
};
|
|
46
|
+
roots.forEach(visit);
|
|
47
|
+
return flat;
|
|
48
|
+
}
|
|
49
|
+
function formatCpuPercent(value) {
|
|
50
|
+
return value == null ? "—" : `${value.toFixed(1)}%`;
|
|
51
|
+
}
|
|
52
|
+
function knownCpu(samples) {
|
|
53
|
+
return samples.flatMap((sample) => sample.cpuPercent == null ? [] : [sample.cpuPercent]);
|
|
54
|
+
}
|
|
55
|
+
function cpuSeriesByKey(samples) {
|
|
56
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
57
|
+
for (const sample of samples) byKey.set(sample.key, [...byKey.get(sample.key) ?? [], sample]);
|
|
58
|
+
return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));
|
|
59
|
+
}
|
|
60
|
+
function processSeries(samples, key) {
|
|
61
|
+
const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);
|
|
62
|
+
return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };
|
|
63
|
+
}
|
|
64
|
+
function sparklinePoints(values, width, height) {
|
|
65
|
+
if (values.length < 2) return void 0;
|
|
66
|
+
const max = Math.max(...values);
|
|
67
|
+
return values.map((value, index) => {
|
|
68
|
+
const x = index / (values.length - 1) * width;
|
|
69
|
+
const y = max === 0 ? height : height - value / max * height;
|
|
70
|
+
return `${x.toFixed(1)},${y.toFixed(1)}`;
|
|
71
|
+
}).join(" ");
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
buildProcessForest,
|
|
75
|
+
cpuSeriesByKey,
|
|
76
|
+
flattenForest,
|
|
77
|
+
formatCpuPercent,
|
|
78
|
+
formatProcessTimestamp,
|
|
79
|
+
isProcessExited,
|
|
80
|
+
processLifetimeMs,
|
|
81
|
+
processSeries,
|
|
82
|
+
pruneExitedProcesses,
|
|
83
|
+
sparklinePoints
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=process-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree.js","sources":["../../../src/data/traces/process-tree.ts"],"sourcesContent":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/**\n * Drops exited processes from a forest, keeping an exited process only while it\n * still has a live descendant to hang off. Returns new nodes; the input is not\n * modified.\n */\nexport function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n return roots.flatMap((node) => {\n const children = pruneExitedProcesses(node.children);\n return node.exited && children.length === 0 ? [] : [{ ...node, children }];\n });\n}\n\n/** How long the process lived: to its exit, else to the last time it was seen. */\nexport function processLifetimeMs(row: ProcessNodeRow): number {\n return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);\n}\n\n/** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */\nexport function formatProcessTimestamp(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n}\n\n/** The process has exited: by its status, or because an exit time was recorded. */\nexport function isProcessExited(row: ProcessNodeRow): boolean {\n return row.status === \"exited\" || Boolean(row.exitedAt);\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** A CPU % for display, \"—\" while it is still unknown. */\nexport function formatCpuPercent(value: number | null | undefined): string {\n return value == null ? \"—\" : `${value.toFixed(1)}%`;\n}\n\nfunction knownCpu(samples: ProcessSampleRow[]): number[] {\n return samples.flatMap((sample) => (sample.cpuPercent == null ? [] : [sample.cpuPercent]));\n}\n\n/** Each process's known CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));\n}\n\n/** One process's known CPU % and RSS bytes over its samples, in tick order. */\nexport function processSeries(samples: ProcessSampleRow[], key: string): { cpu: number[]; rss: number[] } {\n const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values.length - 1)) * width;\n const y = max === 0 ? height : height - (value / max) * height;\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(\" \");\n}\n"],"names":[],"mappings":"AASA,MAAM,UAAU,CAAC,GAAoB,MACnC,KAAK,MAAM,EAAE,IAAI,SAAS,IAAI,KAAK,MAAM,EAAE,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,EAAE,IAAI;AAQ1E,SAAS,mBAAmB,MAA2C;AAC5E,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,QAAI,MAAM,IAAI,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,qBAAqB,IAAI,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,SAA6B,KAA+C;AACxG,QAAM,MAAM,QAAQ,OAAO,CAAC,WAAW,OAAO,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;AACzF,SAAO,EAAE,KAAK,SAAS,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,WAAW,OAAO,QAAQ,EAAA;AACvE;AAGO,SAAS,gBAAgB,QAAkB,OAAe,QAAoC;AACnG,MAAI,OAAO,SAAS,EAAG,QAAO;AAC9B,QAAM,MAAM,KAAK,IAAI,GAAG,MAAM;AAC9B,SAAO,OACJ,IAAI,CAAC,OAAO,UAAU;AACrB,UAAM,IAAK,SAAS,OAAO,SAAS,KAAM;AAC1C,UAAM,IAAI,QAAQ,IAAI,SAAS,SAAU,QAAQ,MAAO;AACxD,WAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAAA,EACxC,CAAC,EACA,KAAK,GAAG;AACb;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const format = require("../../lib/format.cjs");
|
|
4
|
+
function profileValueTypes(samples) {
|
|
5
|
+
const seen = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const sample of samples) {
|
|
7
|
+
if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });
|
|
8
|
+
}
|
|
9
|
+
return [...seen.values()];
|
|
10
|
+
}
|
|
11
|
+
function ofType(samples, sampleType) {
|
|
12
|
+
const own = samples.filter((sample) => sample.sampleType === sampleType);
|
|
13
|
+
const units = new Set(own.map((sample) => sample.unit));
|
|
14
|
+
if (units.size > 1) {
|
|
15
|
+
throw new Error(`sample type "${sampleType}" has mixed units ${[...units].map((unit) => `"${unit}"`).join(", ")}`);
|
|
16
|
+
}
|
|
17
|
+
for (const sample of own) {
|
|
18
|
+
if (sample.frames.length === 0) throw new Error(`a "${sampleType}" sample has no frames`);
|
|
19
|
+
}
|
|
20
|
+
return own;
|
|
21
|
+
}
|
|
22
|
+
function aggregateProfile(samples, sampleType) {
|
|
23
|
+
var _a;
|
|
24
|
+
const own = ofType(samples, sampleType);
|
|
25
|
+
const rows = /* @__PURE__ */ new Map();
|
|
26
|
+
let total = 0;
|
|
27
|
+
for (const sample of own) {
|
|
28
|
+
total += sample.value;
|
|
29
|
+
for (const frame of sample.frames) {
|
|
30
|
+
if (!rows.has(frame.func)) {
|
|
31
|
+
rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func).cum += sample.value;
|
|
35
|
+
rows.get(sample.frames[0].func).flat += sample.value;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
total,
|
|
39
|
+
unit: ((_a = own[0]) == null ? void 0 : _a.unit) ?? "",
|
|
40
|
+
functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func))
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function stacksThrough(samples, sampleType, func, limit) {
|
|
44
|
+
const stacks = /* @__PURE__ */ new Map();
|
|
45
|
+
for (const sample of ofType(samples, sampleType)) {
|
|
46
|
+
if (!sample.frames.some((frame) => frame.func === func)) continue;
|
|
47
|
+
const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join("\n");
|
|
48
|
+
const stack = stacks.get(id);
|
|
49
|
+
if (stack) stack.value += sample.value;
|
|
50
|
+
else stacks.set(id, { frames: sample.frames, value: sample.value });
|
|
51
|
+
}
|
|
52
|
+
return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);
|
|
53
|
+
}
|
|
54
|
+
const NANOS_PER_MS = 1e6;
|
|
55
|
+
function formatProfileValue(value, unit) {
|
|
56
|
+
switch (unit) {
|
|
57
|
+
case "bytes":
|
|
58
|
+
return format.formatBytes(value);
|
|
59
|
+
case "nanoseconds":
|
|
60
|
+
return Math.abs(value) < NANOS_PER_MS ? `${format.formatShort(value / 1e3)} µs` : format.formatDuration(value / NANOS_PER_MS);
|
|
61
|
+
case "microseconds":
|
|
62
|
+
return Math.abs(value) < 1e3 ? `${format.formatShort(value)} µs` : format.formatDuration(value / 1e3);
|
|
63
|
+
case "milliseconds":
|
|
64
|
+
return format.formatDuration(value);
|
|
65
|
+
case "seconds":
|
|
66
|
+
return format.formatDuration(value, { from: "s" });
|
|
67
|
+
case "count":
|
|
68
|
+
case "":
|
|
69
|
+
return format.formatShort(value);
|
|
70
|
+
default:
|
|
71
|
+
return `${format.formatShort(value)} ${unit}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.aggregateProfile = aggregateProfile;
|
|
75
|
+
exports.formatProfileValue = formatProfileValue;
|
|
76
|
+
exports.profileValueTypes = profileValueTypes;
|
|
77
|
+
exports.stacksThrough = stacksThrough;
|
|
78
|
+
//# sourceMappingURL=profile-aggregate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-aggregate.cjs","sources":["../../../src/data/traces/profile-aggregate.ts"],"sourcesContent":["import { formatBytes, formatDuration, formatShort } from \"../../lib/format\";\nimport type { ProfileSample, StackFrame } from \"./types\";\n\n/** A sample type of a profile with its unit, for example `cpu` in `nanoseconds`. */\nexport type ProfileValueType = { sampleType: string; unit: string };\n\n/** One function's share of a profile. */\nexport type ProfileFunctionRow = {\n func: string;\n /** Where the function was first seen in the samples. */\n file: string;\n line: number;\n /** Value of the samples whose innermost frame is this function. */\n flat: number;\n /** Value of the samples whose stack contains this function at all, counted once per sample. */\n cum: number;\n};\n\nexport type ProfileAggregate = {\n total: number;\n unit: string;\n /** Every function, sorted by `flat` descending. */\n functions: ProfileFunctionRow[];\n};\n\n/** A distinct stack and the value of all the samples that shared it. */\nexport type ProfileStack = { frames: StackFrame[]; value: number };\n\n/** The sample types present, in order of first appearance. */\nexport function profileValueTypes(samples: ProfileSample[]): ProfileValueType[] {\n const seen = new Map<string, ProfileValueType>();\n for (const sample of samples) {\n if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });\n }\n return [...seen.values()];\n}\n\nfunction ofType(samples: ProfileSample[], sampleType: string): ProfileSample[] {\n const own = samples.filter((sample) => sample.sampleType === sampleType);\n const units = new Set(own.map((sample) => sample.unit));\n if (units.size > 1) {\n throw new Error(`sample type \"${sampleType}\" has mixed units ${[...units].map((unit) => `\"${unit}\"`).join(\", \")}`);\n }\n for (const sample of own) {\n if (sample.frames.length === 0) throw new Error(`a \"${sampleType}\" sample has no frames`);\n }\n return own;\n}\n\n/**\n * Totals one sample type's samples per function: flat (the innermost frame) and\n * cumulative (anywhere in the stack, once per sample even when the function\n * recurses). Frames are innermost first.\n */\nexport function aggregateProfile(samples: ProfileSample[], sampleType: string): ProfileAggregate {\n const own = ofType(samples, sampleType);\n const rows = new Map<string, ProfileFunctionRow>();\n let total = 0;\n for (const sample of own) {\n total += sample.value;\n for (const frame of sample.frames) {\n if (!rows.has(frame.func)) {\n rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });\n }\n }\n for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func)!.cum += sample.value;\n rows.get(sample.frames[0]!.func)!.flat += sample.value;\n }\n return {\n total,\n unit: own[0]?.unit ?? \"\",\n functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func)),\n };\n}\n\n/** The heaviest distinct stacks of one sample type that pass through `func`, heaviest first. */\nexport function stacksThrough(samples: ProfileSample[], sampleType: string, func: string, limit: number): ProfileStack[] {\n const stacks = new Map<string, ProfileStack>();\n for (const sample of ofType(samples, sampleType)) {\n if (!sample.frames.some((frame) => frame.func === func)) continue;\n const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join(\"\\n\");\n const stack = stacks.get(id);\n if (stack) stack.value += sample.value;\n else stacks.set(id, { frames: sample.frames, value: sample.value });\n }\n return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);\n}\n\nconst NANOS_PER_MS = 1e6;\n\n/** A profile value for display in its unit: bytes, durations and plain counts. */\nexport function formatProfileValue(value: number, unit: string): string {\n switch (unit) {\n case \"bytes\":\n return formatBytes(value);\n case \"nanoseconds\":\n return Math.abs(value) < NANOS_PER_MS ? `${formatShort(value / 1e3)} µs` : formatDuration(value / NANOS_PER_MS);\n case \"microseconds\":\n return Math.abs(value) < 1e3 ? `${formatShort(value)} µs` : formatDuration(value / 1e3);\n case \"milliseconds\":\n return formatDuration(value);\n case \"seconds\":\n return formatDuration(value, { from: \"s\" });\n case \"count\":\n case \"\":\n return formatShort(value);\n default:\n return `${formatShort(value)} ${unit}`;\n }\n}\n"],"names":["formatBytes","formatShort","formatDuration"],"mappings":";;;AA6BO,SAAS,kBAAkB,SAA8C;AAC9E,QAAM,2BAAW,IAAA;AACjB,aAAW,UAAU,SAAS;AAC5B,QAAI,CAAC,KAAK,IAAI,OAAO,UAAU,EAAG,MAAK,IAAI,OAAO,YAAY,EAAE,YAAY,OAAO,YAAY,MAAM,OAAO,MAAM;AAAA,EACpH;AACA,SAAO,CAAC,GAAG,KAAK,QAAQ;AAC1B;AAEA,SAAS,OAAO,SAA0B,YAAqC;AAC7E,QAAM,MAAM,QAAQ,OAAO,CAAC,WAAW,OAAO,eAAe,UAAU;AACvE,QAAM,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC;AACtD,MAAI,MAAM,OAAO,GAAG;AAClB,UAAM,IAAI,MAAM,gBAAgB,UAAU,qBAAqB,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,GAAG,EAAE,KAAK,IAAI,CAAC,EAAE;AAAA,EACnH;AACA,aAAW,UAAU,KAAK;AACxB,QA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;AAC9F,UAAM,QAAQ,OAAO,IAAI,EAAE;AAC3B,QAAI,MAAO,OAAM,SAAS,OAAO;AAAA,QAC5B,QAAO,IAAI,IAAI,EAAE,QAAQ,OAAO,QAAQ,OAAO,OAAO,OAAO;AAAA,EACpE;AACA,SAAO,CAAC,GAAG,OAAO,OAAA,CAAQ,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK;AAC9E;AAEA,MAAM,eAAe;AAGd,SAAS,mBAAmB,OAAe,MAAsB;AACtE,UAAQ,MAAA;AAAA,IACN,KAAK;AACH,aAAOA,OAAAA,YAAY,KAAK;AAAA,IAC1B,KAAK;AACH,aAAO,KAAK,IAAI,KAAK,IAAI,eAAe,GAAGC,OAAAA,YAAY,QAAQ,GAAG,CAAC,QAAQC,OAAAA,eAAe,QAAQ,YAAY;AAAA,IAChH,KAAK;AACH,aAAO,KAAK,IAAI,KAAK,IAAI,MAAM,GAAGD,mBAAY,KAAK,CAAC,QAAQC,OAAAA,eAAe,QAAQ,GAAG;AAAA,IACxF,KAAK;AACH,aAAOA,OAAAA,eAAe,KAAK;AAAA,IAC7B,KAAK;AACH,aAAOA,OAAAA,eAAe,OAAO,EAAE,MAAM,KAAK;AAAA,IAC5C,KAAK;AAAA,IACL,KAAK;AACH,aAAOD,OAAAA,YAAY,KAAK;AAAA,IAC1B;AACE,aAAO,GAAGA,OAAAA,YAAY,KAAK,CAAC,IAAI,IAAI;AAAA,EAAA;AAE1C;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ProfileSample, StackFrame } from './types.js';
|
|
2
|
+
/** A sample type of a profile with its unit, for example `cpu` in `nanoseconds`. */
|
|
3
|
+
export type ProfileValueType = {
|
|
4
|
+
sampleType: string;
|
|
5
|
+
unit: string;
|
|
6
|
+
};
|
|
7
|
+
/** One function's share of a profile. */
|
|
8
|
+
export type ProfileFunctionRow = {
|
|
9
|
+
func: string;
|
|
10
|
+
/** Where the function was first seen in the samples. */
|
|
11
|
+
file: string;
|
|
12
|
+
line: number;
|
|
13
|
+
/** Value of the samples whose innermost frame is this function. */
|
|
14
|
+
flat: number;
|
|
15
|
+
/** Value of the samples whose stack contains this function at all, counted once per sample. */
|
|
16
|
+
cum: number;
|
|
17
|
+
};
|
|
18
|
+
export type ProfileAggregate = {
|
|
19
|
+
total: number;
|
|
20
|
+
unit: string;
|
|
21
|
+
/** Every function, sorted by `flat` descending. */
|
|
22
|
+
functions: ProfileFunctionRow[];
|
|
23
|
+
};
|
|
24
|
+
/** A distinct stack and the value of all the samples that shared it. */
|
|
25
|
+
export type ProfileStack = {
|
|
26
|
+
frames: StackFrame[];
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
/** The sample types present, in order of first appearance. */
|
|
30
|
+
export declare function profileValueTypes(samples: ProfileSample[]): ProfileValueType[];
|
|
31
|
+
/**
|
|
32
|
+
* Totals one sample type's samples per function: flat (the innermost frame) and
|
|
33
|
+
* cumulative (anywhere in the stack, once per sample even when the function
|
|
34
|
+
* recurses). Frames are innermost first.
|
|
35
|
+
*/
|
|
36
|
+
export declare function aggregateProfile(samples: ProfileSample[], sampleType: string): ProfileAggregate;
|
|
37
|
+
/** The heaviest distinct stacks of one sample type that pass through `func`, heaviest first. */
|
|
38
|
+
export declare function stacksThrough(samples: ProfileSample[], sampleType: string, func: string, limit: number): ProfileStack[];
|
|
39
|
+
/** A profile value for display in its unit: bytes, durations and plain counts. */
|
|
40
|
+
export declare function formatProfileValue(value: number, unit: string): string;
|
|
41
|
+
//# sourceMappingURL=profile-aggregate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-aggregate.d.ts","sourceRoot":"","sources":["../../../src/data/traces/profile-aggregate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEzD,oFAAoF;AACpF,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,yCAAyC;AACzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG;IAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,gBAAgB,EAAE,CAM9E;AAcD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAmB/F;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CAUvH;AAID,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBtE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { formatShort, formatDuration, formatBytes } from "../../lib/format.js";
|
|
2
|
+
function profileValueTypes(samples) {
|
|
3
|
+
const seen = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const sample of samples) {
|
|
5
|
+
if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });
|
|
6
|
+
}
|
|
7
|
+
return [...seen.values()];
|
|
8
|
+
}
|
|
9
|
+
function ofType(samples, sampleType) {
|
|
10
|
+
const own = samples.filter((sample) => sample.sampleType === sampleType);
|
|
11
|
+
const units = new Set(own.map((sample) => sample.unit));
|
|
12
|
+
if (units.size > 1) {
|
|
13
|
+
throw new Error(`sample type "${sampleType}" has mixed units ${[...units].map((unit) => `"${unit}"`).join(", ")}`);
|
|
14
|
+
}
|
|
15
|
+
for (const sample of own) {
|
|
16
|
+
if (sample.frames.length === 0) throw new Error(`a "${sampleType}" sample has no frames`);
|
|
17
|
+
}
|
|
18
|
+
return own;
|
|
19
|
+
}
|
|
20
|
+
function aggregateProfile(samples, sampleType) {
|
|
21
|
+
var _a;
|
|
22
|
+
const own = ofType(samples, sampleType);
|
|
23
|
+
const rows = /* @__PURE__ */ new Map();
|
|
24
|
+
let total = 0;
|
|
25
|
+
for (const sample of own) {
|
|
26
|
+
total += sample.value;
|
|
27
|
+
for (const frame of sample.frames) {
|
|
28
|
+
if (!rows.has(frame.func)) {
|
|
29
|
+
rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func).cum += sample.value;
|
|
33
|
+
rows.get(sample.frames[0].func).flat += sample.value;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
total,
|
|
37
|
+
unit: ((_a = own[0]) == null ? void 0 : _a.unit) ?? "",
|
|
38
|
+
functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func))
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function stacksThrough(samples, sampleType, func, limit) {
|
|
42
|
+
const stacks = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const sample of ofType(samples, sampleType)) {
|
|
44
|
+
if (!sample.frames.some((frame) => frame.func === func)) continue;
|
|
45
|
+
const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join("\n");
|
|
46
|
+
const stack = stacks.get(id);
|
|
47
|
+
if (stack) stack.value += sample.value;
|
|
48
|
+
else stacks.set(id, { frames: sample.frames, value: sample.value });
|
|
49
|
+
}
|
|
50
|
+
return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);
|
|
51
|
+
}
|
|
52
|
+
const NANOS_PER_MS = 1e6;
|
|
53
|
+
function formatProfileValue(value, unit) {
|
|
54
|
+
switch (unit) {
|
|
55
|
+
case "bytes":
|
|
56
|
+
return formatBytes(value);
|
|
57
|
+
case "nanoseconds":
|
|
58
|
+
return Math.abs(value) < NANOS_PER_MS ? `${formatShort(value / 1e3)} µs` : formatDuration(value / NANOS_PER_MS);
|
|
59
|
+
case "microseconds":
|
|
60
|
+
return Math.abs(value) < 1e3 ? `${formatShort(value)} µs` : formatDuration(value / 1e3);
|
|
61
|
+
case "milliseconds":
|
|
62
|
+
return formatDuration(value);
|
|
63
|
+
case "seconds":
|
|
64
|
+
return formatDuration(value, { from: "s" });
|
|
65
|
+
case "count":
|
|
66
|
+
case "":
|
|
67
|
+
return formatShort(value);
|
|
68
|
+
default:
|
|
69
|
+
return `${formatShort(value)} ${unit}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
aggregateProfile,
|
|
74
|
+
formatProfileValue,
|
|
75
|
+
profileValueTypes,
|
|
76
|
+
stacksThrough
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=profile-aggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-aggregate.js","sources":["../../../src/data/traces/profile-aggregate.ts"],"sourcesContent":["import { formatBytes, formatDuration, formatShort } from \"../../lib/format\";\nimport type { ProfileSample, StackFrame } from \"./types\";\n\n/** A sample type of a profile with its unit, for example `cpu` in `nanoseconds`. */\nexport type ProfileValueType = { sampleType: string; unit: string };\n\n/** One function's share of a profile. */\nexport type ProfileFunctionRow = {\n func: string;\n /** Where the function was first seen in the samples. */\n file: string;\n line: number;\n /** Value of the samples whose innermost frame is this function. */\n flat: number;\n /** Value of the samples whose stack contains this function at all, counted once per sample. */\n cum: number;\n};\n\nexport type ProfileAggregate = {\n total: number;\n unit: string;\n /** Every function, sorted by `flat` descending. */\n functions: ProfileFunctionRow[];\n};\n\n/** A distinct stack and the value of all the samples that shared it. */\nexport type ProfileStack = { frames: StackFrame[]; value: number };\n\n/** The sample types present, in order of first appearance. */\nexport function profileValueTypes(samples: ProfileSample[]): ProfileValueType[] {\n const seen = new Map<string, ProfileValueType>();\n for (const sample of samples) {\n if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });\n }\n return [...seen.values()];\n}\n\nfunction ofType(samples: ProfileSample[], sampleType: string): ProfileSample[] {\n const own = samples.filter((sample) => sample.sampleType === sampleType);\n const units = new Set(own.map((sample) => sample.unit));\n if (units.size > 1) {\n throw new Error(`sample type \"${sampleType}\" has mixed units ${[...units].map((unit) => `\"${unit}\"`).join(\", \")}`);\n }\n for (const sample of own) {\n if (sample.frames.length === 0) throw new Error(`a \"${sampleType}\" sample has no frames`);\n }\n return own;\n}\n\n/**\n * Totals one sample type's samples per function: flat (the innermost frame) and\n * cumulative (anywhere in the stack, once per sample even when the function\n * recurses). Frames are innermost first.\n */\nexport function aggregateProfile(samples: ProfileSample[], sampleType: string): ProfileAggregate {\n const own = ofType(samples, sampleType);\n const rows = new Map<string, ProfileFunctionRow>();\n let total = 0;\n for (const sample of own) {\n total += sample.value;\n for (const frame of sample.frames) {\n if (!rows.has(frame.func)) {\n rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });\n }\n }\n for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func)!.cum += sample.value;\n rows.get(sample.frames[0]!.func)!.flat += sample.value;\n }\n return {\n total,\n unit: own[0]?.unit ?? \"\",\n functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func)),\n };\n}\n\n/** The heaviest distinct stacks of one sample type that pass through `func`, heaviest first. */\nexport function stacksThrough(samples: ProfileSample[], sampleType: string, func: string, limit: number): ProfileStack[] {\n const stacks = new Map<string, ProfileStack>();\n for (const sample of ofType(samples, sampleType)) {\n if (!sample.frames.some((frame) => frame.func === func)) continue;\n const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join(\"\\n\");\n const stack = stacks.get(id);\n if (stack) stack.value += sample.value;\n else stacks.set(id, { frames: sample.frames, value: sample.value });\n }\n return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);\n}\n\nconst NANOS_PER_MS = 1e6;\n\n/** A profile value for display in its unit: bytes, durations and plain counts. */\nexport function formatProfileValue(value: number, unit: string): string {\n switch (unit) {\n case \"bytes\":\n return formatBytes(value);\n case \"nanoseconds\":\n return Math.abs(value) < NANOS_PER_MS ? `${formatShort(value / 1e3)} µs` : formatDuration(value / NANOS_PER_MS);\n case \"microseconds\":\n return Math.abs(value) < 1e3 ? `${formatShort(value)} µs` : formatDuration(value / 1e3);\n case \"milliseconds\":\n return formatDuration(value);\n case \"seconds\":\n return formatDuration(value, { from: \"s\" });\n case \"count\":\n case \"\":\n return formatShort(value);\n default:\n return `${formatShort(value)} ${unit}`;\n }\n}\n"],"names":[],"mappings":";AA6BO,SAAS,kBAAkB,SAA8C;AAC9E,QAAM,2BAAW,IAAA;AACjB,aAAW,UAAU,SAAS;AAC5B,QAAI,CAAC,KAAK,IAAI,OAAO,UAAU,EAAG,MAAK,IAAI,OAAO,YAAY,EAAE,YAAY,OAAO,YAAY,MAAM,OAAO,MAAM;AAAA,EACpH;AACA,SAAO,CAAC,GAAG,KAAK,QAAQ;AAC1B;AAEA,SAAS,OAAO,SAA0B,YA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@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const format = require("../../lib/format.cjs");
|
|
4
|
+
function formatStatementDuration(ms) {
|
|
5
|
+
if (ms >= 100) return format.formatDuration(ms);
|
|
6
|
+
return `${Number(ms.toFixed(1))} ms`;
|
|
7
|
+
}
|
|
8
|
+
function sumKnownRows(statements) {
|
|
9
|
+
const known = statements.filter((statement) => statement.rows >= 0);
|
|
10
|
+
return known.length === 0 ? -1 : known.reduce((total, statement) => total + statement.rows, 0);
|
|
11
|
+
}
|
|
12
|
+
function toDisplayRow(id, statements) {
|
|
13
|
+
var _a;
|
|
14
|
+
const [first] = statements;
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
startedAt: first.startedAt,
|
|
18
|
+
op: first.op,
|
|
19
|
+
tables: first.tables,
|
|
20
|
+
sql: first.sql,
|
|
21
|
+
durationMs: statements.reduce((total, statement) => total + statement.durationMs, 0),
|
|
22
|
+
rows: sumKnownRows(statements),
|
|
23
|
+
error: ((_a = statements.find((statement) => statement.error)) == null ? void 0 : _a.error) ?? "",
|
|
24
|
+
failed: statements.filter((statement) => statement.error).length,
|
|
25
|
+
count: statements.length,
|
|
26
|
+
occurrences: statements
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function groupStatements(statements, options) {
|
|
30
|
+
const groups = /* @__PURE__ */ new Map();
|
|
31
|
+
statements.forEach((statement, index) => {
|
|
32
|
+
const key = options.group && statement.repeatKey ? `repeat:${statement.repeatKey}` : `row:${index}`;
|
|
33
|
+
groups.set(key, [...groups.get(key) ?? [], statement]);
|
|
34
|
+
});
|
|
35
|
+
return [...groups].map(([key, members]) => toDisplayRow(key, members));
|
|
36
|
+
}
|
|
37
|
+
exports.formatStatementDuration = formatStatementDuration;
|
|
38
|
+
exports.groupStatements = groupStatements;
|
|
39
|
+
//# sourceMappingURL=sql-trace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-trace.cjs","sources":["../../../src/data/traces/sql-trace.ts"],"sourcesContent":["import { formatDuration } from \"../../lib/format\";\nimport type { SqlStatementRow } from \"./types\";\n\n/** One table row: a statement, or every execution of statements sharing a `repeatKey`. */\nexport type SqlDisplayRow = {\n id: string;\n startedAt: string;\n op: string;\n tables: string[];\n sql: string;\n /** Total of the executions. */\n durationMs: number;\n /** Rows the executions returned, or -1 when no driver could tell. */\n rows: number;\n /** The first error among the executions, or \"\". */\n error: string;\n /** How many executions returned an error. */\n failed: number;\n /** How many executions the row stands for. */\n count: number;\n occurrences: SqlStatementRow[];\n};\n\n/** A statement's duration: sub-100ms values keep a decimal (a fast query is 0.9 ms, not 1 ms), longer ones read as elsewhere. */\nexport function formatStatementDuration(ms: number): string {\n if (ms >= 100) return formatDuration(ms);\n return `${Number(ms.toFixed(1))} ms`;\n}\n\nfunction sumKnownRows(statements: SqlStatementRow[]): number {\n const known = statements.filter((statement) => statement.rows >= 0);\n return known.length === 0 ? -1 : known.reduce((total, statement) => total + statement.rows, 0);\n}\n\nfunction toDisplayRow(id: string, statements: SqlStatementRow[]): SqlDisplayRow {\n const [first] = statements as [SqlStatementRow, ...SqlStatementRow[]];\n return {\n id,\n startedAt: first.startedAt,\n op: first.op,\n tables: first.tables,\n sql: first.sql,\n durationMs: statements.reduce((total, statement) => total + statement.durationMs, 0),\n rows: sumKnownRows(statements),\n error: statements.find((statement) => statement.error)?.error ?? \"\",\n failed: statements.filter((statement) => statement.error).length,\n count: statements.length,\n occurrences: statements,\n };\n}\n\n/**\n * Turns statements into table rows. With `group`, statements sharing a\n * non-empty `repeatKey` (the same statement run with different values) become\n * one row, placed where the first of them ran.\n */\nexport function groupStatements(statements: SqlStatementRow[], options: { group: boolean }): SqlDisplayRow[] {\n const groups = new Map<string, SqlStatementRow[]>();\n statements.forEach((statement, index) => {\n const key = options.group && statement.repeatKey ? `repeat:${statement.repeatKey}` : `row:${index}`;\n groups.set(key, [...(groups.get(key) ?? []), statement]);\n });\n return [...groups].map(([key, members]) => toDisplayRow(key, members));\n}\n"],"names":["formatDuration"],"mappings":";;;AAwBO,SAAS,wBAAwB,IAAoB;AAC1D,MAAI,MAAM,IAAK,QAAOA,OAAAA,eAAe,EAAE;AACvC,SAAO,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC;AACjC;AAEA,SAAS,aAAa,YAAuC;AAC3D,QAAM,QAAQ,WAAW,OAAO,CAAC,cAAc,UAAU,QAAQ,CAAC;AAClE,SAAO,MAAM,WAAW,IAAI,KAAK,MAAM,OAAO,CAAC,OAAO,cAAc,QAAQ,UAAU,MAAM,CAAC;AAC/F;AAEA,SAAS,aAAa,IAAY,YAA8C;;AAC9E,QAAM,CAAC,KAAK,IAAI;AAChB,SAAO;AAAA,IACL;AAAA,IACA,WAAW,MAAM;AAAA,IACjB,IAAI,MAAM;AAAA,IACV,QAAQ,MAAM;AAAA,IACd,KAAK,MAAM;AAAA,IACX,YAAY,WAAW,OAAO,CAAC,OAAO,cAAc,QAAQ,UAAU,YAAY,CAAC;AAAA,IACnF,MAAM,aAAa,UAAU;AAAA,IAC7B,SAAO,gBAAW,KAAK,CAAC,cAAc,UAAU,KAAK,MAA9C,mBAAiD,UAAS;AAAA,IACjE,QAAQ,WAAW,OAAO,CAAC,cAAc,UAAU,KAAK,EAAE;AAAA,IAC1D,OAAO,WAAW;AAAA,IAClB,aAAa;AAAA,EAAA;AAEjB;AAOO,SAAS,gBAAgB,YAA+B,SAA8C;AAC3G,QAAM,6BAAa,IAAA;AACnB,aAAW,QAAQ,CAAC,WAAW,UAAU;AACvC,UAAM,MAAM,QAAQ,SAAS,UAAU,YAAY,UAAU,UAAU,SAAS,KAAK,OAAO,KAAK;AACjG,WAAO,IAAI,KAAK,CAAC,GAAI,OAAO,IAAI,GAAG,KAAK,IAAK,SAAS,CAAC;AAAA,EACzD,CAAC;AACD,SAAO,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,KAAK,OAAO,CAAC;AACvE;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SqlStatementRow } from './types.js';
|
|
2
|
+
/** One table row: a statement, or every execution of statements sharing a `repeatKey`. */
|
|
3
|
+
export type SqlDisplayRow = {
|
|
4
|
+
id: string;
|
|
5
|
+
startedAt: string;
|
|
6
|
+
op: string;
|
|
7
|
+
tables: string[];
|
|
8
|
+
sql: string;
|
|
9
|
+
/** Total of the executions. */
|
|
10
|
+
durationMs: number;
|
|
11
|
+
/** Rows the executions returned, or -1 when no driver could tell. */
|
|
12
|
+
rows: number;
|
|
13
|
+
/** The first error among the executions, or "". */
|
|
14
|
+
error: string;
|
|
15
|
+
/** How many executions returned an error. */
|
|
16
|
+
failed: number;
|
|
17
|
+
/** How many executions the row stands for. */
|
|
18
|
+
count: number;
|
|
19
|
+
occurrences: SqlStatementRow[];
|
|
20
|
+
};
|
|
21
|
+
/** A statement's duration: sub-100ms values keep a decimal (a fast query is 0.9 ms, not 1 ms), longer ones read as elsewhere. */
|
|
22
|
+
export declare function formatStatementDuration(ms: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Turns statements into table rows. With `group`, statements sharing a
|
|
25
|
+
* non-empty `repeatKey` (the same statement run with different values) become
|
|
26
|
+
* one row, placed where the first of them ran.
|
|
27
|
+
*/
|
|
28
|
+
export declare function groupStatements(statements: SqlStatementRow[], options: {
|
|
29
|
+
group: boolean;
|
|
30
|
+
}): SqlDisplayRow[];
|
|
31
|
+
//# sourceMappingURL=sql-trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-trace.d.ts","sourceRoot":"","sources":["../../../src/data/traces/sql-trace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC,CAAC;AAEF,iIAAiI;AACjI,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG1D;AAwBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,EAAE,CAO3G"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { formatDuration } from "../../lib/format.js";
|
|
2
|
+
function formatStatementDuration(ms) {
|
|
3
|
+
if (ms >= 100) return formatDuration(ms);
|
|
4
|
+
return `${Number(ms.toFixed(1))} ms`;
|
|
5
|
+
}
|
|
6
|
+
function sumKnownRows(statements) {
|
|
7
|
+
const known = statements.filter((statement) => statement.rows >= 0);
|
|
8
|
+
return known.length === 0 ? -1 : known.reduce((total, statement) => total + statement.rows, 0);
|
|
9
|
+
}
|
|
10
|
+
function toDisplayRow(id, statements) {
|
|
11
|
+
var _a;
|
|
12
|
+
const [first] = statements;
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
startedAt: first.startedAt,
|
|
16
|
+
op: first.op,
|
|
17
|
+
tables: first.tables,
|
|
18
|
+
sql: first.sql,
|
|
19
|
+
durationMs: statements.reduce((total, statement) => total + statement.durationMs, 0),
|
|
20
|
+
rows: sumKnownRows(statements),
|
|
21
|
+
error: ((_a = statements.find((statement) => statement.error)) == null ? void 0 : _a.error) ?? "",
|
|
22
|
+
failed: statements.filter((statement) => statement.error).length,
|
|
23
|
+
count: statements.length,
|
|
24
|
+
occurrences: statements
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function groupStatements(statements, options) {
|
|
28
|
+
const groups = /* @__PURE__ */ new Map();
|
|
29
|
+
statements.forEach((statement, index) => {
|
|
30
|
+
const key = options.group && statement.repeatKey ? `repeat:${statement.repeatKey}` : `row:${index}`;
|
|
31
|
+
groups.set(key, [...groups.get(key) ?? [], statement]);
|
|
32
|
+
});
|
|
33
|
+
return [...groups].map(([key, members]) => toDisplayRow(key, members));
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
formatStatementDuration,
|
|
37
|
+
groupStatements
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=sql-trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-trace.js","sources":["../../../src/data/traces/sql-trace.ts"],"sourcesContent":["import { formatDuration } from \"../../lib/format\";\nimport type { SqlStatementRow } from \"./types\";\n\n/** One table row: a statement, or every execution of statements sharing a `repeatKey`. */\nexport type SqlDisplayRow = {\n id: string;\n startedAt: string;\n op: string;\n tables: string[];\n sql: string;\n /** Total of the executions. */\n durationMs: number;\n /** Rows the executions returned, or -1 when no driver could tell. */\n rows: number;\n /** The first error among the executions, or \"\". */\n error: string;\n /** How many executions returned an error. */\n failed: number;\n /** How many executions the row stands for. */\n count: number;\n occurrences: SqlStatementRow[];\n};\n\n/** A statement's duration: sub-100ms values keep a decimal (a fast query is 0.9 ms, not 1 ms), longer ones read as elsewhere. */\nexport function formatStatementDuration(ms: number): string {\n if (ms >= 100) return formatDuration(ms);\n return `${Number(ms.toFixed(1))} ms`;\n}\n\nfunction sumKnownRows(statements: SqlStatementRow[]): number {\n const known = statements.filter((statement) => statement.rows >= 0);\n return known.length === 0 ? -1 : known.reduce((total, statement) => total + statement.rows, 0);\n}\n\nfunction toDisplayRow(id: string, statements: SqlStatementRow[]): SqlDisplayRow {\n const [first] = statements as [SqlStatementRow, ...SqlStatementRow[]];\n return {\n id,\n startedAt: first.startedAt,\n op: first.op,\n tables: first.tables,\n sql: first.sql,\n durationMs: statements.reduce((total, statement) => total + statement.durationMs, 0),\n rows: sumKnownRows(statements),\n error: statements.find((statement) => statement.error)?.error ?? \"\",\n failed: statements.filter((statement) => statement.error).length,\n count: statements.length,\n occurrences: statements,\n };\n}\n\n/**\n * Turns statements into table rows. With `group`, statements sharing a\n * non-empty `repeatKey` (the same statement run with different values) become\n * one row, placed where the first of them ran.\n */\nexport function groupStatements(statements: SqlStatementRow[], options: { group: boolean }): SqlDisplayRow[] {\n const groups = new Map<string, SqlStatementRow[]>();\n statements.forEach((statement, index) => {\n const key = options.group && statement.repeatKey ? `repeat:${statement.repeatKey}` : `row:${index}`;\n groups.set(key, [...(groups.get(key) ?? []), statement]);\n });\n return [...groups].map(([key, members]) => toDisplayRow(key, members));\n}\n"],"names":[],"mappings":";AAwBO,SAAS,wBAAwB,IAAoB;AAC1D,MAAI,MAAM,IAAK,QAAO,eAAe,EAAE;AACvC,SAAO,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC;AACjC;AAEA,SAAS,aAAa,YAAuC;AAC3D,QAAM,QAAQ,WAAW,OAAO,CAAC,cAAc,UAAU,QAAQ,CAAC;AAClE,SAAO,MAAM,WAAW,IAAI,KAAK,MAAM,OAAO,CAAC,OAAO,cAAc,QAAQ,UAAU,MAAM,CAAC;AAC/F;AAEA,SAAS,aAAa,IAAY,YAA8C;;AAC9E,QAAM,CAAC,KAAK,IAAI;AAChB,SAAO;AAAA,IACL;AAAA,IACA,WAAW,MAAM;AAAA,IACjB,IAAI,MAAM;AAAA,IACV,QAAQ,MAAM;AAAA,IACd,KAAK,MAAM;AAAA,IACX,YAAY,WAAW,OAAO,CAAC,OAAO,cAAc,QAAQ,UAAU,YAAY,CAAC;AAAA,IACnF,MAAM,aAAa,UAAU;AAAA,IAC7B,SAAO,gBAAW,KAAK,CAAC,cAAc,UAAU,KAAK,MAA9C,mBAAiD,UAAS;AAAA,IACjE,QAAQ,WAAW,OAAO,CAAC,cAAc,UAAU,KAAK,EAAE;AAAA,IAC1D,OAAO,WAAW;AAAA,IAClB,aAAa;AAAA,EAAA;AAEjB;AAOO,SAAS,gBAAgB,YAA+B,SAA8C;AAC3G,QAAM,6BAAa,IAAA;AACnB,aAAW,QAAQ,CAAC,WAAW,UAAU;AACvC,UAAM,MAAM,QAAQ,SAAS,UAAU,YAAY,UAAU,UAAU,SAAS,KAAK,OAAO,KAAK;AACjG,WAAO,IAAI,KAAK,CAAC,GAAI,OAAO,IAAI,GAAG,KAAK,IAAK,SAAS,CAAC;AAAA,EACzD,CAAC;AACD,SAAO,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,KAAK,OAAO,CAAC;AACvE;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function stackCheckpoints(records, key) {
|
|
4
|
+
const byCheckpoint = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const record of records) {
|
|
6
|
+
if (record.key !== key) continue;
|
|
7
|
+
byCheckpoint.set(record.checkpointId, [...byCheckpoint.get(record.checkpointId) ?? [], record]);
|
|
8
|
+
}
|
|
9
|
+
return [...byCheckpoint].map(([checkpointId, group]) => {
|
|
10
|
+
const [first] = group;
|
|
11
|
+
return {
|
|
12
|
+
checkpointId,
|
|
13
|
+
takenAt: first.takenAt,
|
|
14
|
+
reason: first.reason,
|
|
15
|
+
transport: first.transport,
|
|
16
|
+
failed: group.some((record) => record.error),
|
|
17
|
+
records: group
|
|
18
|
+
};
|
|
19
|
+
}).sort((a, b) => Date.parse(a.takenAt) - Date.parse(b.takenAt));
|
|
20
|
+
}
|
|
21
|
+
exports.stackCheckpoints = stackCheckpoints;
|
|
22
|
+
//# sourceMappingURL=stack-checkpoints.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-checkpoints.cjs","sources":["../../../src/data/traces/stack-checkpoints.ts"],"sourcesContent":["import type { StackRecord } from \"./types\";\n\n/** The stack records one checkpoint took of one process. */\nexport type StackCheckpoint = {\n checkpointId: string;\n takenAt: string;\n reason: string;\n transport: string;\n /** The checkpoint's dump failed: its single record carries an error. */\n failed: boolean;\n records: StackRecord[];\n};\n\n/**\n * Groups one process's `stacks` records by checkpoint, oldest first, so the\n * last entry is the latest. Records of other processes are ignored. A\n * checkpoint's time, reason and transport are those of its first record.\n */\nexport function stackCheckpoints(records: StackRecord[], key: string): StackCheckpoint[] {\n const byCheckpoint = new Map<string, StackRecord[]>();\n for (const record of records) {\n if (record.key !== key) continue;\n byCheckpoint.set(record.checkpointId, [...(byCheckpoint.get(record.checkpointId) ?? []), record]);\n }\n return [...byCheckpoint]\n .map(([checkpointId, group]): StackCheckpoint => {\n const [first] = group as [StackRecord, ...StackRecord[]];\n return {\n checkpointId,\n takenAt: first.takenAt,\n reason: first.reason,\n transport: first.transport,\n failed: group.some((record) => record.error),\n records: group,\n };\n })\n .sort((a, b) => Date.parse(a.takenAt) - Date.parse(b.takenAt));\n}\n"],"names":[],"mappings":";;AAkBO,SAAS,iBAAiB,SAAwB,KAAgC;AACvF,QAAM,mCAAmB,IAAA;AACzB,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,QAAQ,IAAK;AACxB,iBAAa,IAAI,OAAO,cAAc,CAAC,GAAI,aAAa,IAAI,OAAO,YAAY,KAAK,CAAA,GAAK,MAAM,CAAC;AAAA,EAClG;AACA,SAAO,CAAC,GAAG,YAAY,EACpB,IAAI,CAAC,CAAC,cAAc,KAAK,MAAuB;AAC/C,UAAM,CAAC,KAAK,IAAI;AAChB,WAAO;AAAA,MACL;AAAA,MACA,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM;AAAA,MACd,WAAW,MAAM;AAAA,MACjB,QAAQ,MAAM,KAAK,CAAC,WAAW,OAAO,KAAK;AAAA,MAC3C,SAAS;AAAA,IAAA;AAAA,EAEb,CAAC,EACA,KAAK,CAAC,GAAG,MAAM,KAAK,MAAM,EAAE,OAAO,IAAI,KAAK,MAAM,EAAE,OAAO,CAAC;AACjE;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StackRecord } from './types.js';
|
|
2
|
+
/** The stack records one checkpoint took of one process. */
|
|
3
|
+
export type StackCheckpoint = {
|
|
4
|
+
checkpointId: string;
|
|
5
|
+
takenAt: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
transport: string;
|
|
8
|
+
/** The checkpoint's dump failed: its single record carries an error. */
|
|
9
|
+
failed: boolean;
|
|
10
|
+
records: StackRecord[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Groups one process's `stacks` records by checkpoint, oldest first, so the
|
|
14
|
+
* last entry is the latest. Records of other processes are ignored. A
|
|
15
|
+
* checkpoint's time, reason and transport are those of its first record.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stackCheckpoints(records: StackRecord[], key: string): StackCheckpoint[];
|
|
18
|
+
//# sourceMappingURL=stack-checkpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-checkpoints.d.ts","sourceRoot":"","sources":["../../../src/data/traces/stack-checkpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAmBvF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function stackCheckpoints(records, key) {
|
|
2
|
+
const byCheckpoint = /* @__PURE__ */ new Map();
|
|
3
|
+
for (const record of records) {
|
|
4
|
+
if (record.key !== key) continue;
|
|
5
|
+
byCheckpoint.set(record.checkpointId, [...byCheckpoint.get(record.checkpointId) ?? [], record]);
|
|
6
|
+
}
|
|
7
|
+
return [...byCheckpoint].map(([checkpointId, group]) => {
|
|
8
|
+
const [first] = group;
|
|
9
|
+
return {
|
|
10
|
+
checkpointId,
|
|
11
|
+
takenAt: first.takenAt,
|
|
12
|
+
reason: first.reason,
|
|
13
|
+
transport: first.transport,
|
|
14
|
+
failed: group.some((record) => record.error),
|
|
15
|
+
records: group
|
|
16
|
+
};
|
|
17
|
+
}).sort((a, b) => Date.parse(a.takenAt) - Date.parse(b.takenAt));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
stackCheckpoints
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=stack-checkpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-checkpoints.js","sources":["../../../src/data/traces/stack-checkpoints.ts"],"sourcesContent":["import type { StackRecord } from \"./types\";\n\n/** The stack records one checkpoint took of one process. */\nexport type StackCheckpoint = {\n checkpointId: string;\n takenAt: string;\n reason: string;\n transport: string;\n /** The checkpoint's dump failed: its single record carries an error. */\n failed: boolean;\n records: StackRecord[];\n};\n\n/**\n * Groups one process's `stacks` records by checkpoint, oldest first, so the\n * last entry is the latest. Records of other processes are ignored. A\n * checkpoint's time, reason and transport are those of its first record.\n */\nexport function stackCheckpoints(records: StackRecord[], key: string): StackCheckpoint[] {\n const byCheckpoint = new Map<string, StackRecord[]>();\n for (const record of records) {\n if (record.key !== key) continue;\n byCheckpoint.set(record.checkpointId, [...(byCheckpoint.get(record.checkpointId) ?? []), record]);\n }\n return [...byCheckpoint]\n .map(([checkpointId, group]): StackCheckpoint => {\n const [first] = group as [StackRecord, ...StackRecord[]];\n return {\n checkpointId,\n takenAt: first.takenAt,\n reason: first.reason,\n transport: first.transport,\n failed: group.some((record) => record.error),\n records: group,\n };\n })\n .sort((a, b) => Date.parse(a.takenAt) - Date.parse(b.takenAt));\n}\n"],"names":[],"mappings":"AAkBO,SAAS,iBAAiB,SAAwB,KAAgC;AACvF,QAAM,mCAAmB,IAAA;AACzB,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,QAAQ,IAAK;AACxB,iBAAa,IAAI,OAAO,cAAc,CAAC,GAAI,aAAa,IAAI,OAAO,YAAY,KAAK,CAAA,GAAK,MAAM,CAAC;AAAA,EAClG;AACA,SAAO,CAAC,GAAG,YAAY,EACpB,IAAI,CAAC,CAAC,cAAc,KAAK,MAAuB;AAC/C,UAAM,CAAC,KAAK,IAAI;AAChB,WAAO;AAAA,MACL;AAAA,MACA,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM;AAAA,MACd,WAAW,MAAM;AAAA,MACjB,QAAQ,MAAM,KAAK,CAAC,WAAW,OAAO,KAAK;AAAA,MAC3C,SAAS;AAAA,IAAA;AAAA,EAEb,CAAC,EACA,KAAK,CAAC,GAAG,MAAM,KAAK,MAAM,EAAE,OAAO,IAAI,KAAK,MAAM,EAAE,OAAO,CAAC;AACjE;"}
|