@@ -146,6 +146,9 @@ pub struct FunctionExecution {
146
146
/// Usage statistics for this instance
147
147
pub usage_stats : AggregatedFunctionUsageStats ,
148
148
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 > ,
149
152
150
153
/// The Convex NPM package version pushed with the module version executed.
151
154
pub udf_server_version : Option < semver:: Version > ,
@@ -282,6 +285,7 @@ impl FunctionExecution {
282
285
vector_index_read_bytes: self . usage_stats. vector_index_read_bytes,
283
286
vector_index_write_bytes: self . usage_stats. vector_index_write_bytes,
284
287
action_memory_used_mb: self . action_memory_used_mb,
288
+ return_bytes: self . return_bytes,
285
289
} ,
286
290
} ,
287
291
} ] ;
@@ -647,6 +651,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
647
651
if outcome. path . is_system ( ) {
648
652
return ;
649
653
}
654
+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
650
655
let execution = FunctionExecution {
651
656
params : UdfParams :: Function {
652
657
error : match & outcome. result {
@@ -668,6 +673,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
668
673
syscall_trace : outcome. syscall_trace . clone ( ) ,
669
674
usage_stats : aggregated,
670
675
action_memory_used_mb : None ,
676
+ return_bytes,
671
677
udf_server_version : outcome. udf_server_version . clone ( ) ,
672
678
identity : outcome. identity . clone ( ) ,
673
679
context,
@@ -801,6 +807,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
801
807
if outcome. path . udf_path . is_system ( ) {
802
808
return ;
803
809
}
810
+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
804
811
let execution = FunctionExecution {
805
812
params : UdfParams :: Function {
806
813
error : outcome. result . err ( ) ,
@@ -819,6 +826,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
819
826
syscall_trace : outcome. syscall_trace ,
820
827
usage_stats : aggregated,
821
828
action_memory_used_mb : None ,
829
+ return_bytes,
822
830
udf_server_version : outcome. udf_server_version ,
823
831
identity : outcome. identity ,
824
832
context,
@@ -893,6 +901,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
893
901
if outcome. path . udf_path . is_system ( ) {
894
902
return ;
895
903
}
904
+ let return_bytes = outcome. result . as_ref ( ) . ok ( ) . map ( |v| v. heap_size ( ) as u64 ) ;
896
905
let execution = FunctionExecution {
897
906
params : UdfParams :: Function {
898
907
error : outcome. result . err ( ) ,
@@ -911,6 +920,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
911
920
syscall_trace : outcome. syscall_trace ,
912
921
usage_stats : aggregated,
913
922
action_memory_used_mb : Some ( completion. memory_in_mb ) ,
923
+ return_bytes,
914
924
udf_server_version : outcome. udf_server_version ,
915
925
identity : outcome. identity ,
916
926
context : completion. context ,
@@ -1053,6 +1063,7 @@ impl<RT: Runtime> FunctionExecutionLog<RT> {
1053
1063
environment : ModuleEnvironment :: Isolate ,
1054
1064
usage_stats : aggregated,
1055
1065
action_memory_used_mb : Some ( outcome. memory_in_mb ( ) ) ,
1066
+ return_bytes : None ,
1056
1067
syscall_trace : outcome. syscall_trace ,
1057
1068
udf_server_version : outcome. udf_server_version ,
1058
1069
identity : outcome. identity ,
0 commit comments