Bug 1667775 - Add a telemetry probe for the reason why a transaction is restarted r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D91595
This commit is contained in:
Kershaw Chang 2020-10-21 15:19:20 +00:00
Родитель 95bfd23d6d
Коммит 2c085933ab
3 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -1396,6 +1396,11 @@ void nsHttpTransaction::Close(nsresult reason) {
mSentData = false;
mReceivedData = false;
LOG(("transaction force restarted\n"));
// Only record the first restart attempt.
if (!mRestartCount) {
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_FORCED);
}
return;
}
@ -1439,11 +1444,34 @@ void nsHttpTransaction::Close(nsresult reason) {
// Note that when echConfig is enabled, it's possible that we don't have a
// usable connection info to retry.
if (mConnInfo && NS_SUCCEEDED(Restart())) {
// Only record the first restart attempt.
if (!mRestartCount) {
if (restartToFallbackConnInfo) {
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_HTTPSSVC_INVOLVED);
} else if (!reallySentData) {
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_NO_DATA_SENT);
} else if (reason == psm::GetXPCOMFromNSSError(
SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA)) {
Telemetry::Accumulate(
Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_DOWNGRADE_WITH_EARLY_DATA);
} else {
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_OTHERS);
}
}
return;
}
}
}
if (!mRestartCount) {
Telemetry::Accumulate(Telemetry::HTTP_TRANSACTION_RESTART_REASON,
TRANSACTION_RESTART_NONE);
}
if (!mResponseIsComplete && NS_SUCCEEDED(reason) && isHttp2or3) {
// Responses without content-length header field are still complete if
// they are transfered over http2 or http3 and the stream is properly

Просмотреть файл

@ -490,6 +490,17 @@ class nsHttpTransaction final : public nsAHttpTransaction,
bool mFastFallbackTriggered = false;
nsCOMPtr<nsITimer> mFastFallbackTimer;
nsCOMPtr<nsISVCBRecord> mFastFallbackRecord;
// IMPORTANT: when adding new values, always add them to the end, otherwise
// it will mess up telemetry.
enum TRANSACTION_RESTART_REASON : uint32_t {
TRANSACTION_RESTART_NONE = 0, // The transacion was not restarted.
TRANSACTION_RESTART_FORCED = 1, // The transaction was forced to restart.
TRANSACTION_RESTART_HTTPSSVC_INVOLVED = 2,
TRANSACTION_RESTART_NO_DATA_SENT = 3,
TRANSACTION_RESTART_DOWNGRADE_WITH_EARLY_DATA = 4,
TRANSACTION_RESTART_OTHERS = 5,
};
};
} // namespace net

Просмотреть файл

@ -15879,5 +15879,15 @@
],
"releaseChannelCollection": "opt-out",
"description": "Ratio of used and unused resources preloaded with link rel=preload tag or response header, broken down by supported resource type."
},
"HTTP_TRANSACTION_RESTART_REASON": {
"record_in_processes": ["main"],
"products": ["firefox"],
"expires_in_version": "never",
"n_values": 50,
"bug_numbers": [1667775],
"alert_emails": ["necko@mozilla.com", "kershaw@mozilla.com"],
"kind": "enumerated",
"description": "The reason why a HTTP transaction is restarted."
}
}