Skip to content

Adding Firefox use counter data to HTTPArchive #971

Open

Description

@zcorpan

Hey folks,

In HTTPArchive/legacy.httparchive.org#59 Chrome's use counter data was added to httparchive.

The relevant code in this repo seems to be https://github.com/HTTPArchive/data-pipeline/blob/41fe511951797d25cebc71097726c8b65497212b/modules/import_all.py#L146

I'd like to have Firefox use counter data also be available in httparchive. (Maybe more things also, but starting with use counters.) To that end, I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1813593 so that the data can be extracted locally.

Are there considerations we should know about for this to work?

cc @emilio @janodvarko

Activity

  1. rviscomi commented on Jan 31, 2023

    @rviscomi
    Member

    We only run tests in Chrome, so I don't think this would be feasible. @pmeenan WDYT?

  2. zcorpan commented on Jan 31, 2023

    @zcorpan
    Author

    Why not? We'd need to also run tests in desktop Firefox, in addition to current desktop Chrome and Android Chrome. I don't think it's necessarily useful to collect and store everything for Firefox that is currently stored for Chrome, that would increase storage with 50%. But only use counter data seems negligible for storage.

  3. tunetheweb commented on Jan 31, 2023

    @tunetheweb
    Member

    It’s not just storage. It’s also crawl capacity.

  4. pmeenan commented on Jan 31, 2023

    @pmeenan
    Member

    As it stands right now, it takes ~25,000 VM's the better part of a week to collect the data. Technically it is pretty easy to support but financially it would increase the running costs by ~30% (assuming we'd only run one config). I'm guessing some form of additional sponsorship would be needed to cover the costs.

  5. zcorpan commented on Jan 31, 2023

    @zcorpan
    Author

    OK, thanks. What would that amount to in USD?

  6. rviscomi commented on Jan 31, 2023

    @rviscomi
    Member

    30% of our current crawl expenses would come out to about $20k per month.

  7. zcorpan commented on Jan 31, 2023

    @zcorpan
    Author

    That is likely more than the value Mozilla would get from the data. 🙂

    For web compat analysis, the sample_data URLs (10k pages) would still be better than nothing. Assuming a full run would be 12,500,000 URLs (httparchive.pages.2023_01_01_desktop has 12,647,566 rows), 10k pages would be 0.08% of the cost, which is .... $16.

    Would it be feasible to start there?

  8. zcorpan commented on Feb 6, 2023

    @zcorpan
    Author

    Update: https://bugzilla.mozilla.org/show_bug.cgi?id=1813593 is now fixed (thanks @emilio!). It's possible to set these prefs to log use counter data to stderr:

    • dom.use_counters.dump.document
    • dom.use_counters.dump.worker
    • dom.use_counters.dump.page

    For the purpose of this issue, using page and worker but not document makes most sense. (document is for each document, including e.g. SVGs; these accumulate into page which is per top-level page.) worker use counters don't accumulate into page so need to be included separately.

    The logged output looks like this:

    USE_COUNTER_PAGE: USE_COUNTER2_DOCUMENTOPEN_PAGE - http://software.hixie.ch/utilities/js/live-dom-viewer/
    USE_COUNTER_PAGE: USE_COUNTER2_CSS_PROPERTY_Display_PAGE - http://software.hixie.ch/utilities/js/live-dom-viewer/
    USE_COUNTER_PAGE: USE_COUNTER2_CSS_PROPERTY_FontStyle_PAGE - http://software.hixie.ch/utilities/js/live-dom-viewer/
    USE_COUNTER_PAGE: USE_COUNTER2_CSS_PROPERTY_FontWeight_PAGE - http://software.hixie.ch/utilities/js/live-dom-viewer/
    

    You need to close the page for some of the use counters to be added to the log.

  9. max-ostapenko commented on Jul 14, 2025

    @max-ostapenko
    Contributor

    No development in the last 2 years.
    Closing as outdated.

  10. zcorpan commented on Feb 26, 2026

    @zcorpan
    Author

    There's now a public dashboard for Firefox use counters: https://mozilla.github.io/use-counters/

    With some direction of how to implement this, and maybe with some LLM, I can take a stab at implementing this (for top rank 10k pages or so at first as a PoC).

  11. max-ostapenko commented on Feb 26, 2026

    @max-ostapenko
    Contributor

    Let's do a test 💪

  12. zcorpan commented on Mar 5, 2026

    @zcorpan
    Author

    ChatGPT's suggested approach for implementing a PoC for this issue. Does it seem correct?

    Here’s a practical PoC plan that fits how HTTP Archive already handles Chrome use counters (via _blinkFeatureFirstUsed) and extends it to Firefox use counters by:

    1. making WebPageTest/WPTAgent collect the Firefox dump, and
    2. passing it through the existing HAR → BigQuery import path, and
    3. (optionally) exposing it in derived tables / the site UI.

    This matches the intent in the issue: get Firefox use counters into HTTP Archive, leveraging the “dump to stderr behind prefs” work in Bugzilla. (GitHub)


    What already exists (so we can mirror it)

    Chrome path today

    WPTAgent parses Chromium trace “FeatureFirstUsed/CSSFirstUsed…” events and writes them into a JSON object, which ends up in the HAR page as _blinkFeatureFirstUsed. (GitHub)

    HTTP Archive’s import step (data-pipeline/modules/import_all.py) then reads _blinkFeatureFirstUsed and converts it into the features output field. (GitHub)

    Firefox enabler

    Firefox now has a mechanism to dump use counters to stderr behind prefs dom.use_counters.dump.{document,worker,page}, explicitly to enable local ingestion (like HTTP Archive). (Bugzilla)


    PoC approach

    Goal for the PoC

    For Firefox runs only, add a new HAR page field, e.g.:

    • _geckoUseCounters (name is up to us; choose something clearly namespaced like the blink one)

    …and then teach the pipeline (or a derived query) to turn it into a usable BigQuery table.

    This keeps the PoC minimally invasive: no need to redesign schemas immediately; just “get the data into the payload”.


    Step 1 — Make WPTAgent collect Firefox use counters

    1A) Enable Firefox prefs in the test profile

    In the Firefox runner code path in wptagent (where it writes user.js / prefs), add:

    • dom.use_counters.dump.document = true
    • dom.use_counters.dump.worker = true
    • dom.use_counters.dump.page = true

    These are the prefs introduced for this exact purpose. (GitHub)

    1B) Capture stderr

    Because the dump goes to stderr (Bugzilla), ensure the Firefox launch wrapper pipes stderr to a file in the test run directory (WPT already captures various logs; the PoC can just ensure we have a dedicated file like gecko_use_counters.log).

    1C) Parse the dump into structured JSON

    We don’t have the exact log-line format visible in the public bug view (it’s referenced via the attachment/comment), but the PoC can be robust:

    • Detect lines containing a recognizable prefix/token for use-counter dumps (once you run it locally you’ll see it immediately).

    • Extract:

      • scope: page vs document vs worker
      • url: the logged url is explicitly included to mitigate cross-process races (Bugzilla)
      • counter id/name and count (whatever the dump prints; likely numeric IDs)

    Suggested JSON shape (simple + query-friendly):

    _geckoUseCounters: {
      "page": { "<counter_id>": <count>, ... },
      "documents": { "<url>": { "<counter_id>": <count>, ... }, ... },
      "workers":   { "<url>": { "<counter_id>": <count>, ... }, ... }
    }

    That mirrors the idea that Firefox can dump at different scopes (document/worker/page). (Bugzilla)

    1D) Inject it into the HAR page object

    WPT’s HAR generator already injects extra per-page fields (that’s how _blinkFeatureFirstUsed ends up there). The PoC change is: if Firefox + parsed counters exist, set:

    • page["_geckoUseCounters"] = <json>

    Step 2 — Pass it through HTTP Archive import

    The pipeline already reads “special page fields” like _blinkFeatureFirstUsed. (GitHub)

    For a PoC you have two workable options:

    Option A (lowest friction): keep it in payload

    Do nothing in import_all.py beyond ensuring the HAR payload already contains _geckoUseCounters. Then you can validate ingestion by querying pages.payload JSON in BigQuery.

    Pros: fastest PoC
    Cons: not as nice to query

    Option B (still small): add a get_gecko_use_counters() helper and output a column

    Add code like get_features() but for Gecko, producing either:

    • a new top-level field on pages like "gecko_use_counters": <json string> (similar to how other sections are JSON-stringified), or
    • populate the existing features array with type: "gecko" records (but that loses counts unless you extend the schema)

    If you want to mirror the existing “features” output shape, note that get_features() currently converts Blink’s structure into rows with feature, type, id. (GitHub)
    For Gecko, you probably want {id, count, scope, url?} — so it’s cleaner as a separate output field/table.


    Step 3 — BigQuery derived table (recommended PoC deliverable)

    Once _geckoUseCounters is present (either inside payload or as its own field), create a derived query like:

    • firefox_use_counters table with columns:

      • date, client, page, rank, wptid
      • scope (page|document|worker)
      • context_url (nullable; page scope might not need it)
      • counter_id
      • count

    This is the Firefox analogue to Chrome’s extracted feature-usage data (even though Chrome’s is “first used timestamp” while Firefox is “counts”). The bug discussion already acknowledges Chrome uses a trace-derived format; Firefox will be different. (Bugzilla)


    Quick validation checklist (what I’d do for the PoC)

    1. Run WPT locally with Firefox and the prefs enabled.

    2. Confirm the stderr log contains the dump lines (and includes URLs as mentioned). (Bugzilla)

    3. Confirm HAR log.pages[0] contains _geckoUseCounters.

    4. Run the pipeline import locally on that HAR and confirm the JSON survives into BigQuery (payload or dedicated column).

    5. Write a tiny SQL proof:

      • top 20 counter_ids by total count on a crawl date
      • filter by a specific URL and list counters

    Notes / considerations that matter (even for PoC)

    • Volume / bloat risk: use counters can be large. Keep the PoC conservative:

      • only store non-zero counters
      • optionally cap to top N per scope (or store raw counts but be aware of payload size limits)
    • Cross-process races: Firefox’s design explicitly logs url “all the time” to mitigate races. That’s a hint you should treat the dump as append-only events that need aggregation. (Bugzilla)

    • Schema mismatch vs Chrome: Chrome provides “firstUsed time”; Firefox provides “counts”. Don’t try to force Gecko data into _blinkFeatureFirstUsed-like semantics.


    If you want, I can sketch the exact patch points

    If you tell me which harness you’re using to run Firefox in WPT (classic WPT agent vs wptagent, Docker image, etc.), I can point to the most likely files/functions to modify for:

    • “write prefs into profile”
    • “pipe stderr”
    • “HAR page augmentation”

    But the PoC architecture above is the cleanest way to “fix” the issue request: get Firefox use counter data into HTTP Archive the same way Blink feature usage got in. (GitHub)

  13. pmeenan commented on Mar 5, 2026

    @pmeenan
    Member

    No, Chat GPT's approach is wrong. It looks like it planned a strategy for extracting the use counters locally in the browser as part of a crawl, not using the public dashboard dataset.

  14. zcorpan commented on Mar 24, 2026

    @zcorpan
    Author

    How do you get the use counter data from Firefox into the public dataset?

    Extracting which use counters were hit when loading a page during crawl, and saving that into the public dataset, was my understanding of how it works for Chrome's use counters in httparchive.

  15. pmeenan commented on Mar 24, 2026

    @pmeenan
    Member

    How do you get the use counter data from Firefox into the public dataset?

    Extracting which use counters were hit when loading a page during crawl, and saving that into the public dataset, was my understanding of how it works for Chrome's use counters in httparchive.

    Sure, but that's because the HTTP Archive uses Chrome to crawl the websites. Presumably the mozilla feature usage dashboard is similar to Chrome's where it comes from telemetry reported by the browsers while they are being used but isn't collected or reported on a per-URL basis.

    The implementation plan from Chat GPT and other items discussed earlier involve running a parallel crawl with Firefox to collect the data. I was under the impression that you meant to use the data from the public dashboard in some way.

    If you're resurrecting the idea of running a parallel crawl, I'm happy to point you at the agent code and review any PR's to extract feature usage from the Firefox tests but I'm not signing up to manage the extra crawl infrastructure (the existing infrastructure is mostly on autopilot but I still manage it in my free time).

  16. zcorpan commented on Apr 1, 2026

    @zcorpan
    Author

    Yes, a parallel crawl is exactly what I had in mind.

    I'm happy to point you at the agent code and review any PR's to extract feature usage from the Firefox tests

    Thanks!

    but I'm not signing up to manage the extra crawl infrastructure (the existing infrastructure is mostly on autopilot but I still manage it in my free time).

    Understood. I can own bugs related to Firefox crawl infra.

  17. zcorpan commented on Apr 1, 2026

    @zcorpan
    Author

    Presumably the mozilla feature usage dashboard is similar to Chrome's where it comes from telemetry reported by the browsers while they are being used but isn't collected or reported on a per-URL basis.

    For each use counter (e.g. https://chromestatus.com/metrics/feature/timeline/popularity/675 ) there are two graphs, the top one is from telemetry and the second one is from httparchive. We don't have the second graph for Firefox.

  18. tunetheweb commented on Apr 1, 2026

    @tunetheweb
    Member

    Do we need two crawls?

    The aim of the second part is identify sites that use a particular feature, rather than sites that use a particular feature in Chrome. Chrome is just the delivery mechanism to get that data rather than what we actually care about IMHO. And it was just used cause it exposed more things like this and @pmeenan 's familiarity with it. Prior to 2016 we crawled as Internet Explorer.

    So the question if whether things would report different in Chrome and Firefox? I would expect most to be the same but can think of some differences. For example, if Firefox implemented something that Chrome didn't. Is that what we're looking to address here? And does that happen sufficiently often enough to warrant double crawling (even for a subset)?

  19. zcorpan commented on Apr 1, 2026

    @zcorpan
    Author

    I think there are several aspects:

    • We'd like to be able to implement our own use counters for things we're interested in and be able to do deeper web compat analysis with httparchive for those use counters, without having to ask nicely for Chromium to implement those use counters each time. (e.g. https://issues.chromium.org/issues/460581850)
    • We want to compare usage between Chrome and Firefox when both implement the same feature and we both have comparable use counters.
    • Firefox has some use counters that Chrome doesn't have.

    Possibly there's also interest in comparing performance metrics between Chrome and Firefox.

  20. zcorpan commented on May 7, 2026

    @zcorpan
    Author

    I asked ChatGPT for advice again. Please correct as appropriate

    The agent code @pmeenan meant is in WebPageTest.agent, now under Catchpoint:

    1. Chrome trace use-counter parser
      internal/support/trace_parser.py
      It filters blink.feature_usage, writes _feature_usage.json.gz, and has WriteFeatureUsage / ProcessFeatureUsageEvent. (GitHub)

    2. Where parsed use counters are merged into page data
      internal/process_test.py → merge_blink_features()
      It reads <prefix>_feature_usage.json.gz and stores it as page_data['blinkFeatureFirstUsed']. (GitHub)

    3. HTTP Archive pipeline side
      The issue originally points at data-pipeline/modules/import_all.py, where HTTP Archive imports that field. (GitHub)

    For a Firefox PoC, the closest patch point is likely:

    catchpoint/WebPageTest.agent/internal/process_test.py
    

    Add a sibling to merge_blink_features(), for example merge_gecko_use_counters(), that reads something like:

    <prefix>_gecko_use_counters.json.gz
    

    and stores:

    page_data['geckoUseCounters'] = metrics

    Then separately add the Firefox-side collection/parsing that creates that gzip JSON file.

  21. pmeenan commented on May 7, 2026

    @pmeenan
    Member

    I don't think the technical details are the problem (though knowing where Firefox writes the use counter data to in Moz Logs or otherwise will be necessary).

    To quote my earlier concerns:

    I'm not signing up to manage the extra crawl infrastructure (the existing infrastructure is mostly on autopilot but I still manage it in my free time).

    Finding someone to fund, host and manage a parallel crawl infrastructure with a second browser (at whatever scale is of interest), making sure it stays up to date and working with browser releases, etc is my concern.

  22. zcorpan commented on May 11, 2026

    @zcorpan
    Author

    My response to that was

    Understood. I can own bugs related to Firefox crawl infra.

    Maybe it's more productive to have a call?

  23. pmeenan commented on May 11, 2026

    @pmeenan
    Member

    We have a monthly meeting that would probably be a good place to discuss.

    FWIW, it's not just bugs related to the crawl infra, it's the running of the actual crawl infra for it (and any associated funding). Google is currently providing the crawl infra for the Chrome-based crawling (not the HTTP Archive project itself).

  24. zcorpan commented on May 11, 2026

    @zcorpan
    Author

    OK. The calendar link doesn't seem to work for me. Can you invite [email protected] please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions