File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
components/pipedream_utils
actions/debug-memory-usage Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change
1
+ import pipedream_utils from "../../pipedream_utils.app.mjs" ;
2
+ import v8 from "v8" ;
3
+
4
+ export default {
5
+ name : "Debug Memory Usage" ,
6
+ description : "Get memory usage statistics for the current Pipedream workflow." ,
7
+ key : "pipedream_utils-debug-memory-usage" ,
8
+ version : "0.0.1" ,
9
+ type : "action" ,
10
+ props : {
11
+ pipedream_utils,
12
+ } ,
13
+ async run ( { $ } ) {
14
+ function formatBytes ( bytes ) {
15
+ return `${ ( bytes / 1024 / 1024 ) . toFixed ( 2 ) } MB` ;
16
+ }
17
+
18
+ const stats = v8 . getHeapStatistics ( ) ;
19
+
20
+ $ . export ( "$summary" , "Successfully exported memory usage statistics" ) ;
21
+
22
+ return {
23
+ totalHeapSize : formatBytes ( stats . total_heap_size ) ,
24
+ totalHeapSizeExecutable : formatBytes ( stats . total_heap_size_executable ) ,
25
+ totalPhysicalSize : formatBytes ( stats . total_physical_size ) ,
26
+ totalAvailableSize : formatBytes ( stats . total_available_size ) ,
27
+ usedHeapSize : formatBytes ( stats . used_heap_size ) ,
28
+ heapSizeLimit : formatBytes ( stats . heap_size_limit ) ,
29
+ } ;
30
+ } ,
31
+ } ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @pipedream/pipedream_utils" ,
3
- "version" : " 0.0.4 " ,
3
+ "version" : " 0.0.5 " ,
4
4
"description" : " Pipedream Utils Components" ,
5
5
"main" : " pipedream_utils.app.mjs" ,
6
6
"keywords" : [
You can’t perform that action at this time.
0 commit comments