Closed Bug 1724695 Opened 4 years ago Closed 3 years ago

Maybe not use nsIHttpActivityDistributor in SearchSERPTelemetry.jsm

Categories

(Firefox :: Search, enhancement, P2)

enhancement

Tracking

()

VERIFIED FIXED
100 Branch
Tracking Status
firefox100 --- verified

People

(Reporter: kershaw, Assigned: jteow)

Details

Attachments

(1 file)

Currently, an observer that watches http activities is added here. This causes a lot of activity events (every transaction would dispatch 8 events mostly) need to be dispatched from socket thread to main thread.
Can we maybe observe http-on-examine-response instead?

Product: bugzilla.mozilla.org → Firefox

It looks like we'll get the same channel passed to the function, so if http-on-examine-response is equivalent to Ci.nsIHttpActivityObserver.ACTIVITY_SUBTYPE_TRANSACTION_CLOSE, then I don't see an issue with making a change -

Severity: -- → N/A
Priority: -- → P1
Priority: P1 → P2
Assignee: nobody → jteow

QE-Verify: Once this lands, please run through the search telemetry tests especially with respect to ad clicks.

Flags: qe-verify+

Hey there Kershaw, I'm going to see if I can work on this with assistance from Mark.

The two of us went through the comments in the docs, but could you elaborate a bit on the difference between http-on-examine-response and http-on-stop-request, and if there might be anything to watch for with making that change with respects to the observation of network activity for ad clicks?

Flags: needinfo?(kershaw)

Generally, I think the biggest diffrence between http-on-examine-response and http-on-stop-request is the timing.
http-on-examine-response notification is sent only when a http request receives headers. http-on-stop-request is sent when a http request is completed.
Compared to the current code (ACTIVITY_SUBTYPE_TRANSACTION_CLOSE), I can think of more difference below:

  • ACTIVITY_SUBTYPE_TRANSACTION_CLOSE
    • Observed when a http transaction is closed. This means the response of this http request is only from network.
    • Happens when we receive all data completely.
  • http-on-examine-response
    • Observed when a http request got response headers. Note that the headers can be from network or from cache. If you are only interested in requests from network, you could filter requests by checking isFromCache.
    • This happens before ``ACTIVITY_SUBTYPE_TRANSACTION_CLOSEandhttp-on-stop-request`.
  • http-on-stop-request
    • Observed when a http request is finished.
    • Happens around the same time as ACTIVITY_SUBTYPE_TRANSACTION_CLOSE.
    • This notification also sent in child process and also sent from a http request created by a service worker.
Flags: needinfo?(kershaw)

Thank you very much for the information, Kershaw.

Hey Kershaw, just a follow up question:

I noticed there's another topic called http-on-examine-cached-response that gets a lot of cached responses that aren't sent to http-on-examine-response. I think that would explain why during smoke testing, I wasn't able to trigger isFromCache as true on the http-on-examine-response topic when I saw certain cached events in the network: the event didn't arrive because it wasn't being sent that the topic I was subscribed to. What kind of situations would result in isFromCache being true on the http-on-examine-response topic?

Flags: needinfo?(kershaw)

Additional clarification... would ACTIVITY_SUBTYPE_TRANSACTION_CLOSE be observed for cached responses as well? I think from what you wrote, it wouldn't report the cached situations?

(In reply to James Teow [:jteow] from comment #7)

Hey Kershaw, just a follow up question:

I noticed there's another topic called http-on-examine-cached-response that gets a lot of cached responses that aren't sent to http-on-examine-response. I think that would explain why during smoke testing, I wasn't able to trigger isFromCache as true on the http-on-examine-response topic when I saw certain cached events in the network: the event didn't arrive because it wasn't being sent that the topic I was subscribed to. What kind of situations would result in isFromCache being true on the http-on-examine-response topic?

Sorry, what I said was wrong. So, http-on-examine-response topic is only observed when a response is coming from network.
http-on-examine-response notification is sent in nsHttpChannel::ProcessResponse and nsHttpChannel::ProcessResponse is only called when a response is from network.

Flags: needinfo?(kershaw)

(In reply to Mark Banner (:standard8) from comment #8)

Additional clarification... would ACTIVITY_SUBTYPE_TRANSACTION_CLOSE be observed for cached responses as well? I think from what you wrote, it wouldn't report the cached situations?

No, ACTIVITY_SUBTYPE_TRANSACTION_CLOSE is not observed for cached responses.
ACTIVITY_SUBTYPE_TRANSACTION_CLOSE is only sent inside a http transaction, which is only used for network response.

Thanks for the clarification :kershaw

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ed40d89d0cf6 Switch observer in SearchSERPTelemetry to use http-on-examine-response r=Standard8
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

Issue is verified fixed based on the latest results of adclicks recorded across bing, DDG and google, in the latest nightly search regression run.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

== Change summary for alert #33720 (as of Fri, 01 Apr 2022 16:26:07 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
5% tp5o linux1804-64-shippable-qr e10s fission stylo webrender 220.81 -> 210.27
4% tp5o linux1804-64-shippable-qr e10s fission stylo webrender 218.65 -> 210.11
3% tp5o linux1804-64-shippable-qr e10s fission stylo webrender-sw 209.10 -> 203.16

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=33720

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: