w3c / w3c/resource-timing

Would like a precise way to map PerformanceTimings to FetchEvent

Open
#259 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Bikeshed
Stars
135
Forks
40
PR merge metrics
No merged PRs in 30d

Description

From https://github.com/w3c/ServiceWorker/issues/1179 by @clayw

ServiceWorkerGlobalScope.performance.getEntries() gives me all of the performance timing data that's gone through the service worker, but there's no exact mapping back to the original FetchEvent or client to which they originated. Multiple FetchEvents can have the same URL and thus the same PerformanceEntry.name field, for example.

Some strategies for dealing with this may be to look at the sequencing of when they come in or mapping the actual timings back to the event. But it seems like it shouldn't be necessary to try and do any complicated guesswork, especially if there may be some edge cases (eg, loading two tabs simultaneously, quirks with navigation preload, etc).

Can there be some way to exactly link these via API? For example:

  • WorkerPerformance.getEntriesByClientId(clientId) call to filter by client ids
  • Adding a clientId field into the PerformanceResourceTiming somehow
  • Some sort of thenable from FetchEvent like FetchEvent.getResourceTimings()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue and its linked ServiceWorker issue, then examine how PerformanceTimings, FetchEvent, clients, and navigation preload are related in the current specification. Done requires an agreed API design that exactly links each timing to its originating FetchEvent or client, including repeated URLs and concurrent loads.

Written by the indexing model from the issue text.

Assessment

Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.