Line data Source code
1 : #include "source/common/quic/quic_stats_gatherer.h" 2 : 3 : #include <cstdint> 4 : 5 : namespace Envoy { 6 : namespace Quic { 7 : 8 : void QuicStatsGatherer::OnPacketAcked(int acked_bytes, 9 0 : quic::QuicTime::Delta /* delta_largest_observed */) { 10 0 : bytes_outstanding_ -= acked_bytes; 11 0 : if (bytes_outstanding_ == 0 && fin_sent_ && !logging_done_) { 12 0 : maybeDoDeferredLog(); 13 0 : } 14 0 : } 15 : 16 0 : void QuicStatsGatherer::OnPacketRetransmitted(int retransmitted_bytes) { 17 0 : retransmitted_packets_++; 18 0 : retransmitted_bytes_ += retransmitted_bytes; 19 0 : } 20 : 21 232 : void QuicStatsGatherer::maybeDoDeferredLog(bool record_ack_timing) { 22 232 : logging_done_ = true; 23 232 : if (stream_info_ == nullptr) { 24 232 : return; 25 232 : } 26 0 : if (time_source_ != nullptr && record_ack_timing) { 27 0 : stream_info_->downstreamTiming().onLastDownstreamAckReceived(*time_source_); 28 0 : } 29 0 : stream_info_->addBytesRetransmitted(retransmitted_bytes_); 30 0 : stream_info_->addPacketsRetransmitted(retransmitted_packets_); 31 : 32 0 : const Formatter::HttpFormatterContext log_context{request_header_map_.get(), 33 0 : response_header_map_.get(), 34 0 : response_trailer_map_.get(), 35 0 : {}, 36 0 : AccessLog::AccessLogType::DownstreamEnd}; 37 : 38 0 : for (const AccessLog::InstanceSharedPtr& log_handler : access_log_handlers_) { 39 0 : log_handler->log(log_context, *stream_info_); 40 0 : } 41 0 : } 42 : 43 : } // namespace Quic 44 : } // namespace Envoy