Skip to content

Commit

Permalink
Add alpn to transport summary event
Browse files Browse the repository at this point in the history
Summary: As in title, useful.

Reviewed By: kvtsoy

Differential Revision: D65508296

fbshipit-source-id: f068611399797df4dd422828373b1ddbbceec7df
  • Loading branch information
Matt Joras authored and facebook-github-bot committed Nov 6, 2024
1 parent e0ceaac commit 65bc141
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion quic/api/QuicTransportBaseLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,8 @@ void QuicTransportBaseLite::closeImpl(
uint64_t(conn_->transportSettings.timeReorderingThreshDividend),
conn_->usedZeroRtt,
conn_->version.value_or(QuicVersion::MVFST_INVALID),
conn_->dsrPacketCount});
conn_->dsrPacketCount,
getAppProtocol().value_or("")});
}

// TODO: truncate the error code string to be 1MSS only.
Expand Down
1 change: 1 addition & 0 deletions quic/logging/FileQLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ void FileQLogger::addTransportSummary(const TransportSummaryArgs& args) {
args.usedZeroRtt,
args.quicVersion,
args.dsrPacketCount,
std::move(args.alpn),
refTime));
}

Expand Down
1 change: 1 addition & 0 deletions quic/logging/QLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class QLogger {
bool usedZeroRtt{};
QuicVersion quicVersion{QuicVersion::MVFST_INVALID};
uint64_t dsrPacketCount{};
std::string alpn;
};
virtual void addTransportSummary(const TransportSummaryArgs& args) = 0;
virtual void addCongestionMetricUpdate(
Expand Down
5 changes: 4 additions & 1 deletion quic/logging/QLoggerTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
bool usedZeroRttIn,
QuicVersion quicVersionIn,
uint64_t dsrPacketCountIn,
std::string alpnIn,
std::chrono::microseconds refTimeIn)
: totalBytesSent{totalBytesSentIn},
totalBytesRecvd{totalBytesRecvdIn},
Expand All @@ -442,7 +443,8 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
finalPacketLossTimeReorderingThreshDividend},
usedZeroRtt{usedZeroRttIn},
quicVersion{quicVersionIn},
dsrPacketCount{dsrPacketCountIn} {
dsrPacketCount{dsrPacketCountIn},
alpn{alpnIn} {
eventType = QLogEventType::TransportSummary;
refTime = refTimeIn;
}
Expand Down Expand Up @@ -479,6 +481,7 @@ folly::dynamic QLogTransportSummaryEvent::toDynamic() const {
static_cast<std::underlying_type<decltype(quicVersion)>::type>(
quicVersion);
data["dsr_packet_count"] = dsrPacketCount;
data["alpn"] = alpn;

d.push_back(std::move(data));
return d;
Expand Down
2 changes: 2 additions & 0 deletions quic/logging/QLoggerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
bool usedZeroRtt,
QuicVersion version,
uint64_t dsrPacketCount,
std::string alpn,
std::chrono::microseconds refTimeIn);
~QLogTransportSummaryEvent() override = default;
uint64_t totalBytesSent;
Expand All @@ -503,6 +504,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
bool usedZeroRtt;
QuicVersion quicVersion;
uint64_t dsrPacketCount;
std::string alpn;

FOLLY_NODISCARD folly::dynamic toDynamic() const override;
};
Expand Down
10 changes: 7 additions & 3 deletions quic/logging/test/QLoggerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
47,
false,
QuicVersion::MVFST,
37});
37,
"blah"});

std::unique_ptr<QLogEvent> p = std::move(q.logs[0]);
auto gotEvent = dynamic_cast<QLogTransportSummaryEvent*>(p.get());
Expand All @@ -138,6 +139,7 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
EXPECT_EQ(gotEvent->finalPacketLossTimeReorderingThreshDividend, 47);
EXPECT_EQ(gotEvent->usedZeroRtt, false);
EXPECT_EQ(gotEvent->dsrPacketCount, 37);
EXPECT_EQ(gotEvent->alpn, "blah");
}

TEST_F(QLoggerTest, CongestionMetricUpdateEvent) {
Expand Down Expand Up @@ -856,7 +858,8 @@ TEST_F(QLoggerTest, TransportSummaryFollyDynamic) {
"final_packet_loss_time_reordering_threshold_dividend": 15,
"used_zero_rtt": true,
"quic_version": 4207849474,
"dsr_packet_count": 37
"dsr_packet_count": 37,
"alpn": "blah"
}
]
])");
Expand All @@ -880,7 +883,8 @@ TEST_F(QLoggerTest, TransportSummaryFollyDynamic) {
15,
true,
QuicVersion::MVFST,
37});
37,
"blah"});
folly::dynamic gotDynamic = q.toDynamic();
gotDynamic["traces"][0]["events"][0][0] = "0"; // hardcode reference time
folly::dynamic gotEvents = gotDynamic["traces"][0]["events"];
Expand Down

0 comments on commit 65bc141

Please sign in to comment.