@@ -146,6 +146,9 @@ pub struct FunctionExecution {
146146 /// Usage statistics for this instance
147147 pub usage_stats : AggregatedFunctionUsageStats ,
148148 pub action_memory_used_mb : Option < u64 > ,
149+ /// Size of the returned value in bytes if the function execution was
150+ /// successful, excluding HTTP actions.
151+ pub return_bytes : Option < u64 > ,
149152
150153 /// The Convex NPM package version pushed with the module version executed.
151154 pub udf_server_version : Option < semver:: Version > ,
@@ -282,6 +285,7 @@ impl FunctionExecution {
282285 vector_index_read_bytes: self . usage_stats. vector_index_read_bytes,
283286 vector_index_write_bytes: self . usage_stats. vector_index_write_bytes,
284287 action_memory_used_mb: self . action_memory_used_mb,
288+ return_bytes: self . return_bytes,
285289 } ,
286290 } ,
287291 } ] ;
@@ -647,6 +651,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
647651 if outcome. path . is_system ( ) {
648652 return ;
649653 }
654+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
650655 let execution = FunctionExecution {
651656 params : UdfParams :: Function {
652657 error : match & outcome. result {
@@ -668,6 +673,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
668673 syscall_trace : outcome. syscall_trace . clone ( ) ,
669674 usage_stats : aggregated,
670675 action_memory_used_mb : None ,
676+ return_bytes,
671677 udf_server_version : outcome. udf_server_version . clone ( ) ,
672678 identity : outcome. identity . clone ( ) ,
673679 context,
@@ -801,6 +807,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
801807 if outcome. path . udf_path . is_system ( ) {
802808 return ;
803809 }
810+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
804811 let execution = FunctionExecution {
805812 params : UdfParams :: Function {
806813 error : outcome. result . err ( ) ,
@@ -819,6 +826,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
819826 syscall_trace : outcome. syscall_trace ,
820827 usage_stats : aggregated,
821828 action_memory_used_mb : None ,
829+ return_bytes,
822830 udf_server_version : outcome. udf_server_version ,
823831 identity : outcome. identity ,
824832 context,
@@ -893,6 +901,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
893901 if outcome. path . udf_path . is_system ( ) {
894902 return ;
895903 }
904+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
896905 let execution = FunctionExecution {
897906 params : UdfParams :: Function {
898907 error : outcome. result . err ( ) ,
@@ -911,6 +920,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
911920 syscall_trace : outcome. syscall_trace ,
912921 usage_stats : aggregated,
913922 action_memory_used_mb : Some ( completion. memory_in_mb ) ,
923+ return_bytes,
914924 udf_server_version : outcome. udf_server_version ,
915925 identity : outcome. identity ,
916926 context : completion. context ,
@@ -1053,6 +1063,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
10531063 environment : ModuleEnvironment :: Isolate ,
10541064 usage_stats : aggregated,
10551065 action_memory_used_mb : Some ( outcome. memory_in_mb ( ) ) ,
1066+ return_bytes : None ,
10561067 syscall_trace : outcome. syscall_trace ,
10571068 udf_server_version : outcome. udf_server_version ,
10581069 identity : outcome. identity ,
0 commit comments