tracker: changes to resource fails tracking
This commit is contained in:
parent
b6080b2492
commit
3b68bebf40
3 changed files with 25 additions and 3 deletions
|
|
@ -129,14 +129,14 @@ export const Resource = (resource: IResource) => {
|
||||||
|
|
||||||
export function getResourceFromResourceTiming(msg: ResourceTiming, sessStart: number) {
|
export function getResourceFromResourceTiming(msg: ResourceTiming, sessStart: number) {
|
||||||
// duration might be duration=0 when cached
|
// duration might be duration=0 when cached
|
||||||
const success = msg.duration > 0 || msg.encodedBodySize > 0 || msg.transferredSize > 0
|
const failed = msg.duration === 0 && msg.ttfb === 0 && msg.headerSize === 0 && msg.encodedBodySize === 0 && msg.transferredSize === 0
|
||||||
const type = getResourceType(msg.initiator, msg.url)
|
const type = getResourceType(msg.initiator, msg.url)
|
||||||
return Resource({
|
return Resource({
|
||||||
...msg,
|
...msg,
|
||||||
type,
|
type,
|
||||||
method: type === ResourceType.FETCH ? ".." : "GET", // should be GET for all non-XHR/Fetch resources, right?
|
method: type === ResourceType.FETCH ? ".." : "GET", // should be GET for all non-XHR/Fetch resources, right?
|
||||||
success,
|
success: !failed,
|
||||||
status: success ? '2xx-3xx' : '4xx-5xx',
|
status: !failed ? '2xx-3xx' : '4xx-5xx',
|
||||||
time: Math.max(0, msg.timestamp - sessStart)
|
time: Math.max(0, msg.timestamp - sessStart)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
## 15.0.4
|
||||||
|
|
||||||
|
- support for spritemaps (svg with `use` tags)
|
||||||
|
- improvements for missing resources tracking
|
||||||
|
|
||||||
## 15.0.3
|
## 15.0.3
|
||||||
|
|
||||||
- fixing `failuresOnly` option for network
|
- fixing `failuresOnly` option for network
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,23 @@ export default function (app: App, opts: Partial<Options>): void {
|
||||||
if (shouldSkip) {
|
if (shouldSkip) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const failed = entry.responseEnd === 0 && entry.transferSize === 0
|
||||||
|
if (failed) {
|
||||||
|
app.send(
|
||||||
|
ResourceTiming(
|
||||||
|
entry.startTime + getTimeOrigin(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
entry.name,
|
||||||
|
entry.initiatorType,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
app.send(
|
app.send(
|
||||||
ResourceTiming(
|
ResourceTiming(
|
||||||
entry.startTime + getTimeOrigin(),
|
entry.startTime + getTimeOrigin(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue