GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.47k stars 410 forks source link

Expose ability to reset internal state of metrics (specifically INP) #461

Closed srubin closed 4 months ago

srubin commented 5 months ago

We are using this library to track INP in a large single page app. Sessions with the app can be long -- sometimes hours. We are interested in collecting INP over a smaller time range, rather than for an entire session. The docs indicate that it's important to track changes to INP over time, but INP as reported by this library is only ever increasing. So, it doesn't reflect the experience that a user is having for a given, say, 10 minute span of a session.

I was wondering if there has been any thought about exposing a function that resets the internal state for a given metric. I can fork the library and implement what I need for our use case (e.g., it seems like this might be close to the behavior we need), but I'm wondering if others have run into this, or if there's something I'm missing about my understanding of the library and its best practices.

tunetheweb commented 4 months ago

Duplicate of #448

srubin commented 4 months ago

Missed that, thanks! Closing as a dupe.