tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e3e3556c9403ea0aeb89b6fa267ba18a8c29b0f1
parent fbdfc6a3fb253ab915818edfd2b328ef3937424b
Author: smayya <smayya@mozilla.com>
Date:   Tue,  7 Oct 2025 08:04:44 +0000

Bug 1989186 - remove ondatafinished metrics. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D267309

Diffstat:
Mnetwerk/metrics.yaml | 110-------------------------------------------------------------------------------
Mnetwerk/protocol/http/HttpChannelChild.cpp | 57+++------------------------------------------------------
Mparser/html/nsHtml5StreamParser.cpp | 13-------------
Mparser/html/nsHtml5StreamParser.h | 7-------
4 files changed, 3 insertions(+), 184 deletions(-)

diff --git a/netwerk/metrics.yaml b/netwerk/metrics.yaml @@ -682,116 +682,6 @@ networking: - https_private - http_content_onstart_delay: - type: timing_distribution - time_unit: millisecond - description: > - The time between dispatching OnStartRequest from the socket thread and processing it on the main thread (content process). - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926#c - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - rjesup@mozilla.com - expires: 146 - - http_content_onstop_delay: - type: timing_distribution - time_unit: millisecond - description: > - The time between dispatching OnStopRequest from the socket thread and processing it on the main thread (content process). - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926#c - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - rjesup@mozilla.com - expires: 146 - - http_content_ondatafinished_delay: - type: timing_distribution - time_unit: millisecond - description: > - The time between dispatching OnDataFinished from the socket thread and processing - it on main/background thread. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615#c - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - rjesup@mozilla.com - expires: 146 - - http_content_ondatafinished_delay_2: - type: timing_distribution - time_unit: millisecond - description: > - The time between dispatching OnDataFinished from the socket thread and processing it - on the background thread. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1913140 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615#c - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - jesup@mozilla.com - expires: 146 - - http_content_ondatafinished_to_onstop_delay: - type: timing_distribution - time_unit: millisecond - description: > - The time between processing OnDataFinished and processing OnStopRequest (if OnDataFinished comes first) - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857615#c - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - rjesup@mozilla.com - expires: 146 - - http_content_html5parser_ondatafinished_to_onstop_delay: - type: timing_distribution - time_unit: millisecond - description: > - The time between processing OnDataFinished and processing OnStopRequest (if OnDataFinished comes first) - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1857926 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1902188 - data_sensitivity: - - technical - notification_emails: - - necko@mozilla.com - - rjesup@mozilla.com - expires: 146 http_onstart_suspend_total_time: type: timing_distribution diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp @@ -347,17 +347,11 @@ void HttpChannelChild::ProcessOnStartRequest( LOG(("HttpChannelChild::ProcessOnStartRequest [this=%p]\n", this)); MOZ_ASSERT(OnSocketThread()); - TimeStamp start = TimeStamp::Now(); - mAltDataInputStream = DeserializeIPCStream(aAltData.altDataInputStream()); mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent( this, [self = UnsafePtr<HttpChannelChild>(this), aResponseHead, - aUseResponseHead, aRequestHeaders, aArgs, start]() { - TimeDuration delay = TimeStamp::Now() - start; - glean::networking::http_content_onstart_delay.AccumulateRawDuration( - delay); - + aUseResponseHead, aRequestHeaders, aArgs]() { self->OnStartRequest(aResponseHead, aUseResponseHead, aRequestHeaders, aArgs); })); @@ -868,27 +862,6 @@ void HttpChannelChild::SendOnDataFinished(const nsresult& aChannelStatus) { } } -class RecordStopRequestDelta final { - public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RecordStopRequestDelta); - - TimeStamp mOnStopRequestTime; - TimeStamp mOnDataFinishedTime; - - private: - ~RecordStopRequestDelta() { - if (mOnDataFinishedTime.IsNull() || mOnStopRequestTime.IsNull()) { - return; - } - - TimeDuration delta = (mOnStopRequestTime - mOnDataFinishedTime); - MOZ_ASSERT((delta.ToMilliseconds() >= 0), - "OnDataFinished after OnStopRequest"); - glean::networking::http_content_ondatafinished_to_onstop_delay - .AccumulateRawDuration(delta); - } -}; - void HttpChannelChild::ProcessOnStopRequest( const nsresult& aChannelStatus, const ResourceTimingStructArgs& aTiming, const nsHttpHeaderArray& aResponseTrailers, @@ -906,29 +879,12 @@ void HttpChannelChild::ProcessOnStopRequest( mEncodedBodySize = aTiming.encodedBodySize(); } - RefPtr<RecordStopRequestDelta> timing; - TimeStamp start = TimeStamp::Now(); if (StaticPrefs::network_send_OnDataFinished()) { - timing = new RecordStopRequestDelta; mEventQ->RunOrEnqueue(new ChannelFunctionEvent( [self = UnsafePtr<HttpChannelChild>(this)]() { return self->GetODATarget(); }, - [self = UnsafePtr<HttpChannelChild>(this), status = aChannelStatus, - start, timing]() { - TimeStamp now = TimeStamp::Now(); - TimeDuration delay = now - start; - glean::networking::http_content_ondatafinished_delay - .AccumulateRawDuration(delay); - // We can be on main thread or background thread at this point - // http_content_ondatafinished_delay_2 is used to track - // delay observed between dispatch the OnDataFinished on the socket - // thread and running OnDataFinished on the background thread - if (!NS_IsMainThread()) { - glean::networking::http_content_ondatafinished_delay_2 - .AccumulateRawDuration(delay); - } - timing->mOnDataFinishedTime = now; + [self = UnsafePtr<HttpChannelChild>(this), status = aChannelStatus]() { self->SendOnDataFinished(status); })); } @@ -936,14 +892,7 @@ void HttpChannelChild::ProcessOnStopRequest( this, [self = UnsafePtr<HttpChannelChild>(this), aChannelStatus, aTiming, aResponseTrailers, consoleReports = CopyableTArray{aConsoleReports.Clone()}, - aFromSocketProcess, start, timing]() mutable { - TimeStamp now = TimeStamp::Now(); - TimeDuration delay = now - start; - glean::networking::http_content_onstop_delay.AccumulateRawDuration( - delay); - if (timing) { - timing->mOnStopRequestTime = now; - } + aFromSocketProcess]() mutable { self->OnStopRequest(aChannelStatus, aTiming, aResponseTrailers); if (!aFromSocketProcess) { self->DoOnConsoleReport(std::move(consoleReports)); diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp @@ -24,7 +24,6 @@ #include "mozilla/StaticPrefs_html5.h" #include "mozilla/StaticPrefs_network.h" #include "mozilla/TextUtils.h" -#include "mozilla/glean/NetwerkMetrics.h" #include "mozilla/Unused.h" #include "mozilla/dom/BindingDeclarations.h" @@ -1402,14 +1401,10 @@ nsresult nsHtml5StreamParser::OnStopRequest( if (mOnStopCalled) { // OnStopRequest already executed (probably OMT). MOZ_ASSERT(NS_IsMainThread(), "Expected to run on main thread"); - if (mOnDataFinishedTime) { - mOnStopRequestTime = TimeStamp::Now(); - } } else { mOnStopCalled = true; if (MOZ_UNLIKELY(NS_IsMainThread())) { - MOZ_ASSERT(mOnDataFinishedTime.IsNull(), "stale mOnDataFinishedTime"); nsCOMPtr<nsIRunnable> stopper = new nsHtml5RequestStopper(this); if (NS_FAILED( mEventTarget->Dispatch(stopper, nsIThread::DISPATCH_NORMAL))) { @@ -1418,7 +1413,6 @@ nsresult nsHtml5StreamParser::OnStopRequest( } else { if (StaticPrefs::network_send_OnDataFinished_html5parser()) { MOZ_ASSERT(IsParserThread(), "Wrong thread!"); - mOnDataFinishedTime = TimeStamp::Now(); mozilla::MutexAutoLock autoLock(mTokenizerMutex); DoStopRequest(); PostLoadFlusher(); @@ -1432,13 +1426,6 @@ nsresult nsHtml5StreamParser::OnStopRequest( } } } - if (!mOnStopRequestTime.IsNull() && !mOnDataFinishedTime.IsNull()) { - TimeDuration delta = (mOnStopRequestTime - mOnDataFinishedTime); - MOZ_ASSERT((delta.ToMilliseconds() >= 0), - "OnDataFinished after OnStopRequest"); - glean::networking::http_content_html5parser_ondatafinished_to_onstop_delay - .AccumulateRawDuration(delta); - } return NS_OK; } diff --git a/parser/html/nsHtml5StreamParser.h b/parser/html/nsHtml5StreamParser.h @@ -784,13 +784,6 @@ class nsHtml5StreamParser final : public nsISupports { * nsHtml5StreamListener::mDelegateMonitor passed in the OnStopRequest */ bool mOnStopCalled{false}; - - /* - * Used for telemetry about OnStopRequest vs OnDataFinished - */ - // guarded by nsHtml5StreamListener::mDelegateMonitor - mozilla::TimeStamp mOnStopRequestTime; - mozilla::TimeStamp mOnDataFinishedTime; }; #endif // nsHtml5StreamParser_h