Add pmtuProbingStarted event to instrumentation observer
Summary: ^
MODIFY
quic/api/Observer.h
quic/api/Observer.h
@@ -168,6 +168,13 @@ class InstrumentationObserver {
QuicSocket*, /* socket */
const PacketRTT& /* RTT sample */) {}
+ /**
+ * pmtuProbingStarted() is invoked when server starts d6d.
+ *
+ * @param socket Socket when the callback is processed.
+ */
+ virtual void pmtuProbingStarted(QuicSocket* /* socket */) {}
+
/**
* pmtuBlackholeDetected() is invoked when a PMTU blackhole is detected.
*

MODIFY
quic/api/test/Mocks.h
quic/api/test/Mocks.h
@@ -338,6 +338,7 @@ class MockInstrumentationObserver : public InstrumentationObserver {
,
rttSampleGenerated,
void(QuicSocket*, const PacketRTT&));
+ GMOCK_METHOD1_(, noexcept, , pmtuProbingStarted, void(QuicSocket*));
GMOCK_METHOD2_(
,
noexcept,

MODIFY
quic/server/QuicServerTransport.cpp
quic/server/QuicServerTransport.cpp
@@ -537,6 +537,9 @@ void QuicServerTransport::maybeStartD6DProbing() {
// valuable
conn_->pendingEvents.d6d.sendProbeDelay = kDefaultD6DKickStartDelay;
QUIC_STATS(conn_->statsCallback, onConnectionD6DStarted);
+ for (const auto& cb : conn_->instrumentationObservers_) {
+ cb->pmtuProbingStarted(this);
+ }
}
}

MODIFY
quic/server/test/QuicServerTransportTest.cpp
quic/server/test/QuicServerTransportTest.cpp
@@ -4230,5 +4230,21 @@ TEST_P(
}
testSetupConnection();
}
+
+TEST_P(QuicServerTransportHandshakeTest, TestD6DStartInstrumentationCallback) {
+ auto mockObserver = std::make_unique<MockInstrumentationObserver>();
+ server->addInstrumentationObserver(mockObserver.get());
+ // Set oneRttReader so that maybeStartD6DPriobing passes its check
+ auto codec = std::make_unique<QuicReadCodec>(QuicNodeType::Server);
+ codec->setOneRttReadCipher(createNoOpAead());
+ server->getNonConstConn().readCodec = std::move(codec);
+ // And the state too
+ server->getNonConstConn().d6d.state = D6DMachineState::BASE;
+ EXPECT_CALL(*mockObserver, pmtuProbingStarted(_)).Times(1);
+ // CHLO should be enough to trigger probing
+ recvClientHello();
+ server->removeInstrumentationObserver(mockObserver.get());
+}
+
} // namespace test
} // namespace quic

MODIFY
quic/tools/tperf/tperf.cpp
quic/tools/tperf/tperf.cpp
@@ -78,6 +78,7 @@ DEFINE_uint32(
DEFINE_bool(log_rtt_sample, false, "Log rtt sample events");
DEFINE_bool(log_loss, false, "Log packet loss events");
DEFINE_bool(log_app_rate_limited, false, "Log app rate limited events");
+DEFINE_bool(log_pmtu_probing_started, false, "Log pmtu probing started events");
DEFINE_bool(log_pmtu_upperbound, false, "Log pmtu upper bound events");
DEFINE_bool(log_pmtu_blackhole, false, "Log pmtu blackbole events");
DEFINE_bool(d6d_enabled, false, "Enable d6d");
@@ -154,6 +155,12 @@ class TPerfInstrumentationObserver : public InstrumentationObserver {
}
}
+ void pmtuProbingStarted(QuicSocket* /* socket */) override {
+ if (FLAGS_log_pmtu_probing_started) {
+ LOG(INFO) << "pmtu probing started";
+ }
+ }
+
void pmtuBlackholeDetected(
QuicSocket*, /* socket */
const PMTUBlackholeEvent& /* Blackhole event */) override {

Add pmtuProbingStarted event to instrumentation observer

Summary: ^

Reviewed By: bschlinker

Differential Revision: D24464391

fbshipit-source-id: c976b9496031290cb4b6c3f29862c1f7d4ebf065