Stop tracking http response size and latency from QuicConnectionStats. Not protected.

The http response size and latency in QuicConnectionStats are used to get the average response latency for loss detection tuning. They have been replaced by response sizes and latencies filtered in internal code.

PiperOrigin-RevId: 324068534
Change-Id: I9f474fe34c483b742188a25fd3e3e1896b526786
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 8125724..1bb6f1c 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -2634,11 +2634,9 @@
  public:
   TestAckListener() {}
 
-  ResponseStats OnPacketAcked(
-      int acked_bytes,
-      QuicTime::Delta /*delta_largest_observed*/) override {
+  void OnPacketAcked(int acked_bytes,
+                     QuicTime::Delta /*delta_largest_observed*/) override {
     total_bytes_acked_ += acked_bytes;
-    return ResponseStats();
   }
 
   void OnPacketRetransmitted(int /*retransmitted_bytes*/) override {}
diff --git a/quic/core/http/quic_headers_stream.cc b/quic/core/http/quic_headers_stream.cc
index 406a66c..8157dae 100644
--- a/quic/core/http/quic_headers_stream.cc
+++ b/quic/core/http/quic_headers_stream.cc
@@ -91,11 +91,7 @@
         return false;
       }
       if (header.ack_listener != nullptr && header_length > 0) {
-        auto response_stats =
-            header.ack_listener->OnPacketAcked(header_length, ack_delay_time);
-        if (!response_stats.IsEmpty()) {
-          spdy_session_->RecordServerResponse(response_stats);
-        }
+        header.ack_listener->OnPacketAcked(header_length, ack_delay_time);
       }
       header.unacked_length -= header_length;
       acked_offset += header_length;
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 11ad810..2948371 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -1409,16 +1409,6 @@
       quiche::QuicheStrCat(type, " stream is received twice."));
 }
 
-void QuicSpdySession::RecordServerResponse(ResponseStats response_stats) {
-  DCHECK_EQ(perspective(), Perspective::IS_SERVER);
-  QuicConnectionStats& stats = connection()->mutable_stats();
-
-  ++stats.num_responses;
-  stats.total_response_size += response_stats.response_size;
-  stats.total_response_time =
-      stats.total_response_time + response_stats.response_time;
-}
-
 // static
 void QuicSpdySession::LogHeaderCompressionRatioHistogram(
     bool using_qpack,
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index cb3b986..7e56b27 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -387,9 +387,6 @@
   // Decode SETTINGS from |cached_state| and apply it to the session.
   bool ResumeApplicationState(ApplicationState* cached_state) override;
 
-  // (Server only) Records the response time of a completed request.
-  void RecordServerResponse(ResponseStats response_stats);
-
  protected:
   // Override CreateIncomingStream(), CreateOutgoingBidirectionalStream() and
   // CreateOutgoingUnidirectionalStream() with QuicSpdyStream return type to
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index 01d6b11..4c979c1 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -919,11 +919,8 @@
   DCHECK_LE(newly_acked_header_length, *newly_acked_length);
   unacked_frame_headers_offsets_.Difference(offset, offset + data_length);
   if (ack_listener_ != nullptr && new_data_acked) {
-    auto response_stats = ack_listener_->OnPacketAcked(
+    ack_listener_->OnPacketAcked(
         *newly_acked_length - newly_acked_header_length, ack_delay_time);
-    if (!response_stats.IsEmpty()) {
-      spdy_session_->RecordServerResponse(response_stats);
-    }
   }
   return new_data_acked;
 }
diff --git a/quic/core/quic_ack_listener_interface.h b/quic/core/quic_ack_listener_interface.h
index 7eac817..0a9c694 100644
--- a/quic/core/quic_ack_listener_interface.h
+++ b/quic/core/quic_ack_listener_interface.h
@@ -20,10 +20,8 @@
 
   // Called when a packet is acked.  Called once per packet.
   // |acked_bytes| is the number of data bytes acked.
-  // Return the http response stats if this is the last ack of a server stream.
-  // Otherwise return an empty ResponseStats object.
-  virtual ResponseStats OnPacketAcked(int acked_bytes,
-                                      QuicTime::Delta ack_delay_time) = 0;
+  virtual void OnPacketAcked(int acked_bytes,
+                             QuicTime::Delta ack_delay_time) = 0;
 
   // Called when a packet is retransmitted.  Called once per packet.
   // |retransmitted_bytes| is the number of data bytes retransmitted.
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h
index cd5741b..a751f74 100644
--- a/quic/core/quic_connection_stats.h
+++ b/quic/core/quic_connection_stats.h
@@ -163,19 +163,6 @@
   // Encapsulation.
   QuicPacketCount sent_legacy_version_encapsulated_packets = 0;
 
-  // HTTP server metrics.
-  // Number of success streams. i.e. streams in which all data are acked and
-  // have no stream error.
-  uint64_t num_responses = 0;
-
-  // Total number of HTTP response bytes.
-  QuicByteCount total_response_size = 0;
-
-  // Sum of response times for all success streams. A stream's response time is
-  // the time between stream creation to the time its last ack is received,
-  // minus the peer ack delay in the last ack.
-  QuicTime::Delta total_response_time = QuicTime::Delta::Zero();
-
   // Number of times when the connection tries to send data but gets throttled
   // by amplification factor.
   size_t num_amplification_throttling = 0;
diff --git a/quic/core/quic_types.h b/quic/core/quic_types.h
index 40fd3ad..3818dad 100644
--- a/quic/core/quic_types.h
+++ b/quic/core/quic_types.h
@@ -803,16 +803,6 @@
   }
 };
 
-// Stats for a single HTTP response.
-struct QUIC_NO_EXPORT ResponseStats {
-  QuicByteCount response_size = 0;
-  QuicTime::Delta response_time = QuicTime::Delta::Zero();
-
-  bool IsEmpty() const {
-    return response_size == 0 || response_time <= QuicTime::Delta::Zero();
-  }
-};
-
 }  // namespace quic
 
 #endif  // QUICHE_QUIC_CORE_QUIC_TYPES_H_
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index 9ccd8f4..6a09bb7 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -842,10 +842,7 @@
 
 MockLossAlgorithm::~MockLossAlgorithm() {}
 
-MockAckListener::MockAckListener() {
-  ON_CALL(*this, OnPacketAcked(_, _))
-      .WillByDefault(testing::Return(ResponseStats()));
-}
+MockAckListener::MockAckListener() {}
 
 MockAckListener::~MockAckListener() {}
 
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 1dc1aa8..b29228f 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -1330,7 +1330,7 @@
   MockAckListener(const MockAckListener&) = delete;
   MockAckListener& operator=(const MockAckListener&) = delete;
 
-  MOCK_METHOD(ResponseStats,
+  MOCK_METHOD(void,
               OnPacketAcked,
               (int acked_bytes, QuicTime::Delta ack_delay_time),
               (override));