Telemetry: Remove stubs and related code

This commit is contained in:
adeshkp 2019-01-12 06:20:31 -05:00 • committed by Roy Tam
commit aea50f182f
134 changed files with 68 additions and 3422 deletions

View file

@ -657,12 +657,6 @@ Http2Stream::GenerateOpen()
outputOffset += frameLen;
}
// The size of the input headers is approximate
uint32_t ratio =
compressedData.Length() * 100 /
(11 + requestURI.Length() +
mFlatHttpRequestHeaders.Length());
mFlatHttpRequestHeaders.Truncate();
return NS_OK;
}
@ -980,7 +974,7 @@ Http2Stream::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame)
}
// ConvertResponseHeaders is used to convert the response headers
// into HTTP/1 format and report some telemetry
// into HTTP/1 format
nsresult
Http2Stream::ConvertResponseHeaders(Http2Decompressor *decompressor,
nsACString &aHeadersIn,
@ -1036,7 +1030,7 @@ Http2Stream::ConvertResponseHeaders(Http2Decompressor *decompressor,
}
// ConvertPushHeaders is used to convert the pushed request headers
// into HTTP/1 format and report some telemetry
// into HTTP/1 format
nsresult
Http2Stream::ConvertPushHeaders(Http2Decompressor *decompressor,
nsACString &aHeadersIn,

View file

@ -996,16 +996,6 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener,
}
LOG(("converter removed '%s' content-encoding\n", val));
if (gHttpHandler->IsTelemetryEnabled()) {
int mode = 0;
if (from.Equals("gzip") || from.Equals("x-gzip")) {
mode = 1;
} else if (from.Equals("deflate") || from.Equals("x-deflate")) {
mode = 2;
} else if (from.Equals("br")) {
mode = 3;
}
}
nextListener = converter;
}
else {

View file

@ -83,7 +83,6 @@
#include "nsCRT.h"
#include "CacheObserver.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/Telemetry.h"
#include "AlternateServices.h"
#include "InterceptedChannel.h"
#include "nsIHttpPushListener.h"
@ -123,19 +122,6 @@ static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
static NS_DEFINE_CID(kStreamTransportServiceCID,
NS_STREAMTRANSPORTSERVICE_CID);
enum CacheDisposition {
kCacheHit = 1,
kCacheHitViaReval = 2,
kCacheMissedViaReval = 3,
kCacheMissed = 4
};
void
AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss)
{
/* STUB */
}
// Computes and returns a SHA1 hash of the input buffer. The input buffer
// must be a null-terminated string.
nsresult
@ -494,11 +480,6 @@ nsHttpChannel::ContinueConnect()
event->Revoke();
}
// Don't accumulate the cache hit telemetry for intercepted channels.
if (mInterceptCache != INTERCEPTED) {
AccumulateCacheHitTelemetry(kCacheHit);
}
return rv;
}
else if (mLoadFlags & LOAD_ONLY_FROM_CACHE) {
@ -1085,10 +1066,8 @@ ProcessXCTO(nsIURI* aURI, nsHttpResponseHead* aResponseHead, nsILoadInfo* aLoadI
if (aLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_IMAGE) {
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) {
Accumulate(Telemetry::XCTO_NOSNIFF_BLOCK_IMAGE, 0);
return NS_OK;
}
Accumulate(Telemetry::XCTO_NOSNIFF_BLOCK_IMAGE, 1);
// Instead of consulting Preferences::GetBool() all the time we
// can cache the result to speed things up.
static bool sXCTONosniffBlockImages = false;
@ -2116,29 +2095,6 @@ nsHttpChannel::ContinueProcessResponse2(nsresult rv)
break;
}
if (gHttpHandler->IsTelemetryEnabled()) {
CacheDisposition cacheDisposition;
if (!mDidReval) {
cacheDisposition = kCacheMissed;
} else if (successfulReval) {
cacheDisposition = kCacheHitViaReval;
} else {
cacheDisposition = kCacheMissedViaReval;
}
AccumulateCacheHitTelemetry(cacheDisposition);
if (mResponseHead->Version() == NS_HTTP_VERSION_0_9) {
// DefaultPortTopLevel = 0, DefaultPortSubResource = 1,
// NonDefaultPortTopLevel = 2, NonDefaultPortSubResource = 3
uint32_t v09Info = 0;
if (!(mLoadFlags & LOAD_INITIAL_DOCUMENT_URI)) {
v09Info += 1;
}
if (mConnectionInfo->OriginPort() != mConnectionInfo->DefaultPort()) {
v09Info += 2;
}
}
}
return rv;
}
@ -3784,8 +3740,6 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
(!mCachedResponseHead->ExpiresInPast() ||
!mCachedResponseHead->MustValidateIfExpired())) {
LOG(("NOT validating based on isForcedValid being true.\n"));
Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PREFETCHES_USED> used;
++used;
doValidation = false;
}
// If the LOAD_FROM_CACHE flag is set, any cached data can simply be used
@ -6546,8 +6500,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
if (mTimingEnabled && request == mCachePump) {
mCacheReadEnd = TimeStamp::Now();
ReportNetVSCacheTelemetry();
}
// allow content to be cached if it was loaded successfully (bug #482935)
@ -8104,12 +8056,5 @@ nsHttpChannel::SetDoNotTrack()
}
}
void
nsHttpChannel::ReportNetVSCacheTelemetry()
{
/* STUB */
}
} // namespace net
} // namespace mozilla

View file

@ -431,9 +431,6 @@ private:
rv == NS_ERROR_MALFORMED_URI;
}
// Report net vs cache time telemetry
void ReportNetVSCacheTelemetry();
// Create a aggregate set of the current notification callbacks
// and ensure the transaction is updated to use it.
void UpdateAggregateCallbacks();

View file

@ -35,8 +35,6 @@
#include "mozilla/Unused.h"
#include "nsIURI.h"
#include "mozilla/Telemetry.h"
namespace mozilla {
namespace net {
@ -1186,14 +1184,6 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
transport->SetConnectionFlags(flags);
}
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_USED_SPECULATIVE_CONN> usedSpeculativeConn;
++usedSpeculativeConn;
if (ent->mHalfOpens[i]->IsFromPredictor()) {
Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_USED> totalPreconnectsUsed;
++totalPreconnectsUsed;
}
// return OK because we have essentially opened a new connection
// by converting a speculative half-open to general use
return NS_OK;
@ -1387,14 +1377,6 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
ent->SetYellowConnection(bestConn);
if (!trans->GetPendingTime().IsNull()) {
if (trans->UsesPipelining())
AccumulateTimeDelta(
Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES,
trans->GetPendingTime(), TimeStamp::Now());
else
AccumulateTimeDelta(
Telemetry::TRANSACTION_WAIT_TIME_HTTP,
trans->GetPendingTime(), TimeStamp::Now());
trans->SetPendingTime(false);
}
return true;
@ -1677,8 +1659,6 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
rv = conn->Activate(trans, caps, priority);
MOZ_ASSERT(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch");
if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) {
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_SPDY,
trans->GetPendingTime(), TimeStamp::Now());
trans->SetPendingTime(false);
}
return rv;
@ -1695,12 +1675,6 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
rv = DispatchAbstractTransaction(ent, trans, caps, conn, priority);
if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) {
if (trans->UsesPipelining())
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP_PIPELINES,
trans->GetPendingTime(), TimeStamp::Now());
else
AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_HTTP,
trans->GetPendingTime(), TimeStamp::Now());
trans->SetPendingTime(false);
}
return rv;
@ -1829,12 +1803,6 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent,
return NS_OK;
}
void
nsHttpConnectionMgr::ReportProxyTelemetry(nsConnectionEntry *ent)
{
/* STUB */
}
nsresult
nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
{
@ -1878,8 +1846,6 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
ent = preferredEntry;
}
ReportProxyTelemetry(ent);
// Check if the transaction already has a sticky reference to a connection.
// If so, then we can just use it directly by transferring its reference
// to the new connection variable instead of searching for a new one
@ -1976,13 +1942,9 @@ nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent,
if (speculative) {
sock->SetSpeculative(true);
sock->SetAllow1918(allow1918);
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_TOTAL_SPECULATIVE_CONN> totalSpeculativeConn;
++totalSpeculativeConn;
if (isFromPredictor) {
sock->SetIsFromPredictor(true);
Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_CREATED> totalPreconnectsCreated;
++totalPreconnectsCreated;
}
}
@ -3894,16 +3856,6 @@ nsConnectionEntry::RemoveHalfOpen(nsHalfOpenSocket *halfOpen)
// will result in it not being present in the halfopen table. That's expected.
if (mHalfOpens.RemoveElement(halfOpen)) {
if (halfOpen->IsSpeculative()) {
Telemetry::AutoCounter<Telemetry::HTTPCONNMGR_UNUSED_SPECULATIVE_CONN> unusedSpeculativeConn;
++unusedSpeculativeConn;
if (halfOpen->IsFromPredictor()) {
Telemetry::AutoCounter<Telemetry::PREDICTOR_TOTAL_PRECONNECTS_UNUSED> totalPreconnectsUnused;
++totalPreconnectsUnused;
}
}
MOZ_ASSERT(gHttpHandler->ConnMgr()->mNumHalfOpenConns);
if (gHttpHandler->ConnMgr()->mNumHalfOpenConns) { // just in case
gHttpHandler->ConnMgr()->mNumHalfOpenConns--;

View file

@ -529,7 +529,6 @@ private:
nsresult ProcessNewTransaction(nsHttpTransaction *);
nsresult EnsureSocketThreadTarget();
void ClosePersistentConnections(nsConnectionEntry *ent);
void ReportProxyTelemetry(nsConnectionEntry *ent);
nsresult CreateTransport(nsConnectionEntry *, nsAHttpTransaction *,
uint32_t, bool, bool, bool);
void AddActiveConn(nsHttpConnection *, nsConnectionEntry *);

View file

@ -90,7 +90,6 @@
#define BROWSER_PREF_PREFIX "browser.cache."
#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
#define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
#define TELEMETRY_ENABLED "toolkit.telemetry.enabled"
#define ALLOW_EXPERIMENTS "network.allow-experiments"
#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
#define SECURITY_PREFIX "security."
@ -209,7 +208,6 @@ nsHttpHandler::nsHttpHandler()
, mSafeHintEnabled(false)
, mParentalControlEnabled(false)
, mHandlerActive(false)
, mTelemetryEnabled(false)
, mAllowExperiments(true)
, mDebugObservations(false)
, mEnableSpdy(false)
@ -305,7 +303,6 @@ nsHttpHandler::Init()
prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true);
prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
prefBranch->AddObserver(TELEMETRY_ENABLED, this, true);
prefBranch->AddObserver(H2MANDATORY_SUITE, this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true);
@ -1547,19 +1544,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
// includes telemetry and allow-experiments because of the abtest profile
bool requestTokenBucketUpdated = false;
//
// Telemetry
//
if (PREF_CHANGED(TELEMETRY_ENABLED)) {
cVar = false;
requestTokenBucketUpdated = true;
rv = prefs->GetBoolPref(TELEMETRY_ENABLED, &cVar);
if (NS_SUCCEEDED(rv)) {
mTelemetryEnabled = cVar;
}
}
// "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256" is the required h2 interop
// suite.

View file

@ -105,8 +105,7 @@ public:
bool EnforceAssocReq() { return mEnforceAssocReq; }
bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; }
bool IsTelemetryEnabled() { return mTelemetryEnabled; }
bool AllowExperiments() { return mTelemetryEnabled && mAllowExperiments; }
bool AllowExperiments() { return mAllowExperiments; }
bool IsSpdyEnabled() { return mEnableSpdy; }
bool IsHttp2Enabled() { return mHttp2Enabled; }
@ -509,9 +508,6 @@ private:
// true in between init and shutdown states
Atomic<bool, Relaxed> mHandlerActive;
// Whether telemetry is reported or not
uint32_t mTelemetryEnabled : 1;
// The value of network.allow-experiments
uint32_t mAllowExperiments : 1;