Fix prefetch use telemetry

NEW
Assigned to

Status

()

Core
Networking
P2
normal
2 years ago
7 months ago

People

(Reporter: nwgh, Assigned: nwgh)

Tracking

51 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-active])

Due to a brain fart (or bull-headed ignorance), our telemetry on whether or not a prefetch gets used is mostly (totally?) worthless right now. We should probably fix that, so we can tweak prefetch conditions properly if necessary :)
Honza - in trying to fix this, I'm working on a patch that adds multiple telemetry states per prefetch - one that says "we used this entry", and a few different "we didn't use this prefetched entry because ...". One of the reasons for "we didn't use this entry" should be "because we didn't ask for it until after its forced valid lifetime expired". It looks to me like the best places to keep track of that would be in CacheStorageService::IsForcedValidEntry, CacheStorageService::ForcedValidEntriesPrune, and CacheStorageService::RemoveEntryForceValid. I would have to add a bool to what we keep in the hash of forced valid entries to say "was this looked up while it was forced valid?" along the timestamp, and accumulate telemetry (or not) based on that. Does that seem like a reasonable course of action? (I can attach a proposed patch that probably won't even compile, if that makes my proposal easier to understand)
Flags: needinfo?(honzab.moz)
What you propose sounds reasonable.  Other option, since you can force valid a cache entry only when having CacheEntry (nsICacheEntry) in hands, is to keep this on the CacheEntry class.  If you force-valid an entry, set some flag on CacheEntry.  In AsyncOpen (means someone requested the entry) check if this entry entry is still still valid, if so, drop the flag.  In ~CacheEntry collect the telemetry when the flag is still set (no one requested the entry on time).  Makes sense?  Might be a bit cleaner, but up to you.
Flags: needinfo?(honzab.moz)
Priority: P1 → P2
You need to log in before you can comment on or make changes to this bug.