compute-pressure
compute-pressure copied to clipboard
Allow an array of sources
- Current:
observer.observe('thing'). - Proposal:
observer.observe({things: ['thing1', 'thing2']})(names to be bike-shed).
Similar to PerformanceObserver's entryTpes option.
It seems that using PressureSource is a good/futureproof design. Currently it supports "cpu" and "thermals", but I guess it might support in the future "memory", "io" ("bus", "network"), "gpu", "psi" etc.
These sources might be independent or not, depending on the situation.
There is a question whether do we want to add sources with sequential API calls, in order to catch specific errors (which on the other hand might be a fingerprinting opportunity), - or to specify a list of sources with one call as suggested above, and control the order of adding the sources by the spec algorithm (or by a policy hint from the user). IMHO the API shape is mainly influenced by what errors we want to capture, when and how.