Record the number of ping frames sent in QuicConnectionStats.

This is needed by the Net.QuicSession.NumPingsSent histogram in Chromium: https://source.chromium.org/chromium/chromium/src/+/master:net/quic/quic_chromium_client_session.cc;l=1868?q=num_pings_sent_&ss=chromium

Currently, that histogram uses the value of QuicChromiumClientSession::num_pings_sent_, which is incremented in QuicChromiumClientSession::SendPing, which needs to be deleted after cl/346323537.

PiperOrigin-RevId: 346573315
Change-Id: Ib38b2884ebba1911ea097c3296b4dc003300a6c7
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 3926404..7258d8c 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -2164,6 +2164,7 @@
   if (frame.type == PING_FRAME) {
     // Flush PING frame immediately.
     packet_creator_.FlushCurrentPacket();
+    stats_.ping_frames_sent++;
     if (debug_visitor_ != nullptr) {
       debug_visitor_->OnPingSent();
     }
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h
index 014e25c..c263dd6 100644
--- a/quic/core/quic_connection_stats.h
+++ b/quic/core/quic_connection_stats.h
@@ -190,6 +190,8 @@
   // True if address is validated via validating token received in INITIAL
   // packet.
   bool address_validated_via_token = false;
+
+  size_t ping_frames_sent = 0;
 };
 
 }  // namespace quic