1 // Copyright 2024 gRPC authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H 16 #define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H 17 18 #include <grpc/support/port_platform.h> 19 20 #include <cstdint> 21 22 #include <grpc/status.h> 23 #include <grpc/support/time.h> 24 25 struct grpc_transport_one_way_stats { 26 uint64_t framing_bytes = 0; 27 uint64_t data_bytes = 0; 28 uint64_t header_bytes = 0; 29 }; 30 31 struct grpc_transport_stream_stats { 32 grpc_transport_one_way_stats incoming; 33 grpc_transport_one_way_stats outgoing; 34 gpr_timespec latency = gpr_inf_future(GPR_TIMESPAN); 35 }; 36 37 void grpc_transport_move_one_way_stats(grpc_transport_one_way_stats* from, 38 grpc_transport_one_way_stats* to); 39 40 void grpc_transport_move_stats(grpc_transport_stream_stats* from, 41 grpc_transport_stream_stats* to); 42 43 struct grpc_call_stats { 44 grpc_transport_stream_stats transport_stream_stats; 45 gpr_timespec latency; // From call creating to enqueing of received status 46 }; 47 /// Information about the call upon completion. 48 struct grpc_call_final_info { 49 grpc_call_stats stats; 50 grpc_status_code final_status = GRPC_STATUS_OK; 51 const char* error_string = nullptr; 52 }; 53 54 #endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H 55