From d8ebd8627f7b336452492248cdfd25ba81f170d4 Mon Sep 17 00:00:00 2001 From: k-fish Date: Tue, 27 Jun 2023 14:13:04 -0400 Subject: [PATCH] Fix names for span data --- .../tracing-internal/src/browser/request.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/tracing-internal/src/browser/request.ts b/packages/tracing-internal/src/browser/request.ts index cede8f339216..fc44b312cf92 100644 --- a/packages/tracing-internal/src/browser/request.ts +++ b/packages/tracing-internal/src/browser/request.ts @@ -182,14 +182,21 @@ function addHTTPTimings(span: Span): void { } function resourceTimingEntryToSpanData(resourceTiming: PerformanceResourceTiming): [string, string | number][] { + const version = resourceTiming.nextHopProtocol.split('/')[1]; + + const timingSpanData : [string, string | number][] = []; + if (version) { + timingSpanData.push(['network.protocol.version', version]); + } + if (!browserPerformanceTimeOrigin) { - return [['network.protocol.version', resourceTiming.nextHopProtocol]]; + return timingSpanData; } return [ - ['network.protocol.version', resourceTiming.nextHopProtocol], - ['http.client.connectStart', (browserPerformanceTimeOrigin + resourceTiming.connectStart) / 1000], - ['http.client.requestStart', (browserPerformanceTimeOrigin + resourceTiming.requestStart) / 1000], - ['http.client.responseStart', (browserPerformanceTimeOrigin + resourceTiming.responseStart) / 1000], + ...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], ]; }