Skip to content

Commit

Permalink
feat(checkpoint): new loadresource checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
chicharr committed Oct 23, 2023
1 parent 2845a20 commit d818efc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));

const observer = new PerformanceObserver((list) => {
list.getEntries()
.filter((entry) => (entry.responseStatus < 400) && new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
.filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
.filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
.forEach((entry) => {
sampleRUM('resource', { source: entry.name, target: Math.round(entry.duration) });
sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
});
});
observer.observe({ type: 'resource', buffered: true });

0 comments on commit d818efc

Please sign in to comment.