Add quic stats for d6d events
Summary: This increases visibility over d6d lifecycle.
MODIFY
quic/d6d/QuicD6DStateFunctions.cpp
quic/d6d/QuicD6DStateFunctions.cpp
@@ -24,6 +24,9 @@ static TimePoint reportUpperBound(QuicConnectionStateBase& conn) {
auto& d6d = conn.d6d;
const auto lastProbeSize = d6d.lastProbe->packetSize;
const auto now = Clock::now();
+
+ QUIC_STATS(
+ conn.statsCallback, onConnectionPMTUUpperBoundDetected, lastProbeSize);
if (conn.instrumentationObservers_.size() > 0) {
InstrumentationObserver::PMTUUpperBoundEvent upperBoundEvent(
now,
@@ -51,6 +54,10 @@ static TimePoint reportUpperBound(QuicConnectionStateBase& conn) {
static TimePoint reportBlackhole(
QuicConnectionStateBase& conn,
const OutstandingPacket& packet) {
+ QUIC_STATS(
+ conn.statsCallback,
+ onConnectionPMTUBlackholeDetected,
+ packet.metadata.encodedSize);
auto& d6d = conn.d6d;
const auto now = Clock::now();
if (conn.instrumentationObservers_.size() > 0) {
@@ -117,6 +124,7 @@ void onD6DLastProbeAcked(QuicConnectionStateBase& conn) {
LOG(ERROR) << "D6D lastProbeSize <= udpSendPacketLen";
return;
}
+ QUIC_STATS(conn.statsCallback, onConnectionPMTURaised);
conn.udpSendPacketLen = lastProbeSize;
if (maybeNextProbeSize.hasValue() &&
*maybeNextProbeSize > conn.udpSendPacketLen &&

MODIFY
quic/samples/echo/LogQuicStats.h
quic/samples/echo/LogQuicStats.h
@@ -149,6 +149,26 @@ class LogQuicStats : public quic::QuicTransportStatsCallback {
<< "onUDPSocketWriteError errorType=" << toString(errorType);
}
+ void onConnectionD6DStarted() override {
+ VLOG(2) << prefix_ << "onConnectionD6DStarted";
+ }
+
+ void onConnectionPMTURaised() override {
+ VLOG(2) << prefix_ << "onConnectionPMTURaised";
+ }
+
+ void onConnectionPMTUBlackholeDetected(
+ uint64_t pmtuAtBlackholeTime) override {
+ VLOG(2) << prefix_
+ << "onConnectionPMTUBlackholeDetected pmtuAtBlackholeTime="
+ << pmtuAtBlackholeTime;
+ }
+
+ void onConnectionPMTUUpperBoundDetected(uint64_t pmtuUpperBound) override {
+ VLOG(2) << prefix_ << "onConnectionPMTUUpperBoundDetected pmtuUpperBound="
+ << pmtuUpperBound;
+ }
+
private:
std::string prefix_;
};

MODIFY
quic/server/QuicServerTransport.cpp
quic/server/QuicServerTransport.cpp
@@ -536,6 +536,7 @@ void QuicServerTransport::maybeStartD6DProbing() {
// connections, for which probing is relatively expensive and less
// valuable
conn_->pendingEvents.d6d.sendProbeDelay = kDefaultD6DKickStartDelay;
+ QUIC_STATS(conn_->statsCallback, onConnectionD6DStarted);
}
}

MODIFY
quic/state/QuicTransportStatsCallback.h
quic/state/QuicTransportStatsCallback.h
@@ -136,6 +136,15 @@ class QuicTransportStatsCallback {
virtual void onUDPSocketWriteError(SocketErrorType errorType) = 0;
+ virtual void onConnectionD6DStarted() = 0;
+
+ virtual void onConnectionPMTURaised() = 0;
+
+ virtual void onConnectionPMTUBlackholeDetected(
+ uint64_t pmtuAtBlackholeTime) = 0;
+
+ virtual void onConnectionPMTUUpperBoundDetected(uint64_t pmtuUpperBound) = 0;
+
static const char* toString(ConnectionCloseReason reason) {
switch (reason) {
case ConnectionCloseReason::NONE:

MODIFY
quic/state/test/MockQuicStats.h
quic/state/test/MockQuicStats.h
@@ -47,6 +47,10 @@ class MockQuicStats : public QuicTransportStatsCallback {
MOCK_METHOD1(onRead, void(size_t));
MOCK_METHOD1(onWrite, void(size_t));
MOCK_METHOD1(onUDPSocketWriteError, void(SocketErrorType));
+ MOCK_METHOD0(onConnectionD6DStarted, void());
+ MOCK_METHOD0(onConnectionPMTURaised, void());
+ MOCK_METHOD1(onConnectionPMTUBlackholeDetected, void(uint64_t));
+ MOCK_METHOD1(onConnectionPMTUUpperBoundDetected, void(uint64_t));
};
class MockQuicStatsFactory : public QuicTransportStatsCallbackFactory {

Add quic stats for d6d events

Summary: This increases visibility over d6d lifecycle.

Reviewed By: avasylev

Differential Revision: D24026410

fbshipit-source-id: ee382a5fb60e48d4ee441ad760251673a10c85da