зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1898018 - Migrate probes TLS_EARLY_DATA_NEGOTIATED, TLS_EARLY_DATA_ACCEPTED, and TLS_EARLY_DATA_BYTES_WRITTEN to glean r=valentin,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D211106
This commit is contained in:
Родитель
b73d131da4
Коммит
f16ffb8b9d
|
@ -13,6 +13,7 @@
|
|||
#include "nsHttpConnectionInfo.h"
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsITLSSocketControl.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
|
||||
#define TLS_EARLY_DATA_NOT_AVAILABLE 0
|
||||
#define TLS_EARLY_DATA_AVAILABLE_BUT_NOT_USED 1
|
||||
|
@ -311,26 +312,48 @@ void TlsHandshaker::Check0RttEnabled(nsITLSSocketControl* ssl) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
void TlsHandshaker::EarlyDataTelemetry(int16_t tlsVersion,
|
||||
bool earlyDataAccepted,
|
||||
int64_t aContentBytesWritten0RTT) {
|
||||
// Send the 0RTT telemetry only for tls1.3
|
||||
if (tlsVersion > nsITLSSocketControl::TLS_VERSION_1_2) {
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_NEGOTIATED,
|
||||
(mEarlyDataState == EarlyData::NOT_AVAILABLE)
|
||||
? TLS_EARLY_DATA_NOT_AVAILABLE
|
||||
: ((mEarlyDataState == EarlyData::USED)
|
||||
? TLS_EARLY_DATA_AVAILABLE_AND_USED
|
||||
: TLS_EARLY_DATA_AVAILABLE_BUT_NOT_USED));
|
||||
if (mEarlyDataState == EarlyData::NOT_AVAILABLE) { // not possible
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_NEGOTIATED,
|
||||
TLS_EARLY_DATA_NOT_AVAILABLE);
|
||||
mozilla::glean::network::tls_early_data_negotiated.Get("not_available"_ns)
|
||||
.Add(1);
|
||||
} else if (mEarlyDataState == EarlyData::USED) { // possible and used
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_NEGOTIATED,
|
||||
TLS_EARLY_DATA_AVAILABLE_AND_USED);
|
||||
mozilla::glean::network::tls_early_data_negotiated
|
||||
.Get("available_and_used"_ns)
|
||||
.Add(1);
|
||||
} else { // possible but not used
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_NEGOTIATED,
|
||||
TLS_EARLY_DATA_AVAILABLE_BUT_NOT_USED);
|
||||
mozilla::glean::network::tls_early_data_negotiated
|
||||
.Get("available_but_not_used"_ns)
|
||||
.Add(1);
|
||||
}
|
||||
|
||||
// TLS early data was used and it was accepted/rejected by the remote host.
|
||||
if (EarlyDataUsed()) {
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_ACCEPTED,
|
||||
earlyDataAccepted);
|
||||
mozilla::glean::network::tls_early_data_accepted
|
||||
.Get(earlyDataAccepted ? "accepted"_ns : "not_accepted"_ns)
|
||||
.Add(1);
|
||||
}
|
||||
|
||||
// Amount of bytes sent using TLS early data at the start of a TLS
|
||||
// connection for a given channel.
|
||||
if (earlyDataAccepted) {
|
||||
Telemetry::Accumulate(Telemetry::TLS_EARLY_DATA_BYTES_WRITTEN,
|
||||
aContentBytesWritten0RTT);
|
||||
mozilla::glean::network::tls_early_data_bytes_written
|
||||
.AccumulateSingleSample(aContentBytesWritten0RTT);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla::net
|
||||
|
|
|
@ -45,8 +45,11 @@ class TlsHandshaker : public nsITlsHandshakeCallbackListener {
|
|||
return mEarlyDataState == EarlyData::CANNOT_BE_USED;
|
||||
}
|
||||
void EarlyDataDone();
|
||||
|
||||
#ifndef ANDROID
|
||||
void EarlyDataTelemetry(int16_t tlsVersion, bool earlyDataAccepted,
|
||||
int64_t aContentBytesWritten0RTT);
|
||||
#endif
|
||||
|
||||
bool NPNComplete() const { return mNPNComplete; }
|
||||
bool SetupSSLCalled() const { return mSetupSSLCalled; }
|
||||
|
|
|
@ -271,6 +271,67 @@ network:
|
|||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
|
||||
tls_early_data_negotiated:
|
||||
type: labeled_counter
|
||||
labels:
|
||||
- not_available
|
||||
- available_and_used
|
||||
- available_but_not_used
|
||||
description: >
|
||||
Sending TLS early data was not possible, possible and used, or possible but not used.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1296288
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1654309
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1749881
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
|
||||
tls_early_data_accepted:
|
||||
type: labeled_counter
|
||||
labels:
|
||||
- accepted
|
||||
- rejected
|
||||
description: >
|
||||
TLS early data was used and it was accepted or rejected by the remote host.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1296288
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1654309
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1749881
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
|
||||
tls_early_data_bytes_written:
|
||||
type: custom_distribution
|
||||
unit: byte
|
||||
range_min: 0
|
||||
range_max: 60000
|
||||
bucket_count: 100
|
||||
histogram_type: exponential
|
||||
description: >
|
||||
Amount of bytes sent using TLS early data at the start of a TLS connection for a given channel.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1296288
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1654309
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1749881
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898018
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: TLS_EARLY_DATA_BYTES_WRITTEN
|
||||
|
||||
tls_handshake:
|
||||
type: timing_distribution
|
||||
time_unit: millisecond
|
||||
|
|
|
@ -2476,9 +2476,10 @@ void nsHttpConnection::HandshakeDoneInternal() {
|
|||
mConnInfo->SetLessThanTls13(
|
||||
(tlsVersion < nsITLSSocketControl::TLS_VERSION_1_3) &&
|
||||
(tlsVersion != nsITLSSocketControl::SSL_VERSION_UNKNOWN));
|
||||
|
||||
#ifndef ANDROID
|
||||
mTlsHandshaker->EarlyDataTelemetry(tlsVersion, earlyDataAccepted,
|
||||
mContentBytesWritten0RTT);
|
||||
#endif
|
||||
mTlsHandshaker->EarlyDataDone();
|
||||
|
||||
if (!earlyDataAccepted) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче