fix(tracker): added excludedResourceUrls for timings

This commit is contained in:
nick-delirium 2023-10-18 11:11:01 +02:00
parent d0e189b0cf
commit ca84dd0c0b
2 changed files with 12 additions and 0 deletions

View file

@ -3,6 +3,10 @@
- networkRequest message changed to include `TransferredBodySize`
- tracker now attempts to create proxy for beacon api as well (if its in scope)
# 9.0.10
- added `excludedResourceUrls` to timings options to better sanitize network data
# 9.0.9
- Fix for `{disableStringDict: true}` behavior

View file

@ -83,6 +83,7 @@ export interface Options {
captureResourceTimings: boolean
capturePageLoadTimings: boolean
capturePageRenderTimings: boolean
excludedResourceUrls?: Array<string>
}
export default function (app: App, opts: Partial<Options>): void {
@ -91,6 +92,7 @@ export default function (app: App, opts: Partial<Options>): void {
captureResourceTimings: true,
capturePageLoadTimings: true,
capturePageRenderTimings: true,
excludedResourceUrls: [],
},
opts,
)
@ -108,6 +110,12 @@ export default function (app: App, opts: Partial<Options>): void {
if (resources !== null) {
resources[entry.name] = entry.startTime + entry.duration
}
options.excludedResourceUrls?.forEach((url) => {
if (entry.name.startsWith(url)) {
return
}
})
app.send(
ResourceTiming(
entry.startTime + getTimeOrigin(),