Skip to content

Commit

Permalink
feat(tracing): Add more network timings to http calls
Browse files Browse the repository at this point in the history
There are enough now that we'll have to hide some in the UI, but we should be collecting all of these so we can better determine reasons for initial request delay.
  • Loading branch information
k-fish committed Jul 14, 2023
1 parent 338010e commit d497c9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@ sentryTest('should create fetch spans with http timing', async ({ browserName, g
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace?.trace_id,
data: expect.objectContaining({
'http.request.redirect_start': expect.any(Number),
'http.request.fetch_start': expect.any(Number),
'http.request.domain_lookup_start': expect.any(Number),
'http.request.domain_lookup_end': expect.any(Number),
'http.request.connect_start': expect.any(Number),
'http.request.secure_connection_start': expect.any(Number),
'http.request.connection_end': expect.any(Number),
'http.request.request_start': expect.any(Number),
'http.request.response_start': expect.any(Number),
'http.request.response_end': expect.any(Number),
'network.protocol.version': expect.any(String),
}),
}),
Expand Down
13 changes: 10 additions & 3 deletions packages/tracing-internal/src/browser/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,16 @@ function resourceTimingEntryToSpanData(resourceTiming: PerformanceResourceTiming
}
return [
...timingSpanData,
['http.request.connect_start', (browserPerformanceTimeOrigin + resourceTiming.connectStart) / 1000],
['http.request.request_start', (browserPerformanceTimeOrigin + resourceTiming.requestStart) / 1000],
['http.request.response_start', (browserPerformanceTimeOrigin + resourceTiming.responseStart) / 1000],
['http.request.redirect_start', resourceTiming.redirectStart],
['http.request.fetch_start', resourceTiming.fetchStart],
['http.request.domain_lookup_start', resourceTiming.domainLookupStart],
['http.request.domain_lookup_end', resourceTiming.domainLookupEnd],
['http.request.connect_start', resourceTiming.connectStart],
['http.request.secure_connection_start', resourceTiming.secureConnectionStart],
['http.request.connection_end', resourceTiming.connectEnd],
['http.request.request_start', resourceTiming.requestStart],
['http.request.response_start', resourceTiming.responseStart],
['http.request.response_end', resourceTiming.responseEnd],
];
}

Expand Down

0 comments on commit d497c9b

Please sign in to comment.