mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1688850 - Telemetry about HTTP3 0RTT usage r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D103049
This commit is contained in:
parent
affc82c199
commit
d6e65e8711
@ -163,6 +163,7 @@ nsresult Http3Session::Init(const nsHttpConnectionInfo* aConnInfo,
|
||||
LOG(("Can send ZeroRtt data"));
|
||||
RefPtr<Http3Session> self(this);
|
||||
mState = ZERORTT;
|
||||
mZeroRttStarted = TimeStamp::Now();
|
||||
// Let the nsHttpConnectionMgr know that the connection can accept
|
||||
// transactions.
|
||||
// We need to dispatch the following function to this thread so that
|
||||
@ -178,6 +179,10 @@ nsresult Http3Session::Init(const nsHttpConnectionInfo* aConnInfo,
|
||||
}
|
||||
}
|
||||
|
||||
if (mState != ZERORTT) {
|
||||
ZeroRttTelemetry(ZeroRttOutcome::NOT_USED);
|
||||
}
|
||||
|
||||
// After this line, Http3Session and HttpConnectionUDP become a cycle. We put
|
||||
// this line in the end of Http3Session::Init to make sure Http3Session can be
|
||||
// released when Http3Session::Init early returned.
|
||||
@ -438,6 +443,7 @@ nsresult Http3Session::ProcessEvents(uint32_t count) {
|
||||
if (mState == ZERORTT) {
|
||||
mState = INITIALIZING;
|
||||
Finish0Rtt(true);
|
||||
ZeroRttTelemetry(ZeroRttOutcome::USED_REJECTED);
|
||||
}
|
||||
break;
|
||||
case Http3Event::Tag::ResumptionToken: {
|
||||
@ -461,6 +467,7 @@ nsresult Http3Session::ProcessEvents(uint32_t count) {
|
||||
mSocketControl->HandshakeCompleted();
|
||||
if (was0RTT) {
|
||||
Finish0Rtt(false);
|
||||
ZeroRttTelemetry(ZeroRttOutcome::USED_SUCCEEDED);
|
||||
}
|
||||
|
||||
OnTransportStatus(mSocketTransport, NS_NET_STATUS_CONNECTED_TO, 0);
|
||||
@ -1155,6 +1162,12 @@ void Http3Session::CloseInternal(bool aCallNeqoClose) {
|
||||
if (mState != CONNECTED) {
|
||||
mBeforeConnectedError = true;
|
||||
}
|
||||
|
||||
if (mState == ZERORTT) {
|
||||
ZeroRttTelemetry(aCallNeqoClose ? ZeroRttOutcome::USED_CONN_CLOSED_BY_NECKO
|
||||
: ZeroRttOutcome::USED_CONN_ERROR);
|
||||
}
|
||||
|
||||
mState = CLOSING;
|
||||
Shutdown();
|
||||
|
||||
@ -1713,5 +1726,34 @@ void Http3Session::ReportHttp3Connection() {
|
||||
}
|
||||
}
|
||||
|
||||
void Http3Session::ZeroRttTelemetry(ZeroRttOutcome aOutcome) {
|
||||
Telemetry::Accumulate(Telemetry::HTTP3_0RTT_STATE, aOutcome);
|
||||
|
||||
nsAutoCString key;
|
||||
|
||||
switch (aOutcome) {
|
||||
case USED_SUCCEEDED:
|
||||
key = "succeeded"_ns;
|
||||
break;
|
||||
case USED_REJECTED:
|
||||
key = "rejected"_ns;
|
||||
break;
|
||||
case USED_CONN_ERROR:
|
||||
key = "conn_error"_ns;
|
||||
break;
|
||||
case USED_CONN_CLOSED_BY_NECKO:
|
||||
key = "conn_closed_by_necko"_ns;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!key.IsEmpty()) {
|
||||
MOZ_ASSERT(mZeroRttStarted);
|
||||
Telemetry::AccumulateTimeDelta(Telemetry::HTTP3_0RTT_STATE_DURATION, key,
|
||||
mZeroRttStarted, TimeStamp::Now());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -142,6 +142,15 @@ class Http3Session final : public nsAHttpTransaction,
|
||||
void CloseConnectionTelemetry(CloseError& aError, bool aClosing);
|
||||
void Finish0Rtt(bool aRestart);
|
||||
|
||||
enum ZeroRttOutcome {
|
||||
NOT_USED,
|
||||
USED_SUCCEEDED,
|
||||
USED_REJECTED,
|
||||
USED_CONN_ERROR,
|
||||
USED_CONN_CLOSED_BY_NECKO
|
||||
};
|
||||
void ZeroRttTelemetry(ZeroRttOutcome aOutcome);
|
||||
|
||||
RefPtr<NeqoHttp3Conn> mHttp3Connection;
|
||||
RefPtr<nsAHttpConnection> mConnection;
|
||||
nsRefPtrHashtable<nsUint64HashKey, Http3Stream> mStreamIdHash;
|
||||
@ -199,6 +208,7 @@ class Http3Session final : public nsAHttpTransaction,
|
||||
TimeStamp mConnectionIdleEnd;
|
||||
Maybe<uint64_t> mFirstStreamIdReuseIdleConnection;
|
||||
TimeStamp mTimerShouldTrigger;
|
||||
TimeStamp mZeroRttStarted;
|
||||
uint64_t mBlockedByStreamLimitCount = 0;
|
||||
uint64_t mTransactionsBlockedByStreamLimitCount = 0;
|
||||
uint64_t mTransactionsSenderBlockedByFlowControlCount = 0;
|
||||
|
@ -3378,6 +3378,30 @@
|
||||
"keyed": true,
|
||||
"description": "Error code when http3 connection is closed. Look at Http3Session for more details."
|
||||
},
|
||||
"HTTP3_0RTT_STATE": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
|
||||
"bug_numbers": [1688850],
|
||||
"expires_in_version": "never",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"kind": "enumerated",
|
||||
"n_values": 5,
|
||||
"description": "Collect what is the outcome when 0rtt is used: (0)0RTT_NOT_USED, (1)0RTT_USED_SUCCESS, (2)0RTT_USED_REJECT, (3)0RTT_USED_CONN_ERROR, (4)0RTT_CONN_CLOSED_BY_NECKO."
|
||||
},
|
||||
"HTTP3_0RTT_STATE_DURATION": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
|
||||
"bug_numbers": [1688850],
|
||||
"expires_in_version": "never",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"kind": "exponential",
|
||||
"high": 30000,
|
||||
"n_buckets": 50,
|
||||
"keyed": true,
|
||||
"description": "The time a connection was in the zero rtt state, it is keyed by the zero rtt outcome."
|
||||
},
|
||||
"HTTP3_TIME_TO_REUSE_IDLE_CONNECTTION_MS": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
|
Loading…
Reference in New Issue
Block a user