Skip to content

Commit 0204e6e

Browse files
committed
fix
1 parent 5ea753f commit 0204e6e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

packages/tracing-internal/src/browser/metrics/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export function _addResourceSpans(
423423
data['resource.render_blocking_status'] = entry.renderBlockingStatus;
424424
}
425425
if (parsedUrl.protocol) {
426-
data['url.scheme'] = parsedUrl.protocol;
426+
data['url.scheme'] = parsedUrl.protocol.split(':').pop(); // the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it.
427427
}
428428

429429
if (parsedUrl.host) {

packages/tracing-internal/test/browser/metrics/index.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const mockWindowLocation = {
77
ancestorOrigins: {},
88
href: "https://example.com/path/to/something",
99
origin: "https://example.com",
10-
protocol: "https:",
10+
protocol: "https",
1111
host: "example.com",
1212
hostname: "example.com",
1313
port: "",
@@ -235,12 +235,7 @@ describe('_addResourceSpans', () => {
235235
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
236236
expect(transaction.startChild).toHaveBeenLastCalledWith(
237237
expect.objectContaining({
238-
data: { "server.address": "example.com", "url.same_origin": true, "url.scheme": "https:" },
239-
"description": "/assets/to/css",
240-
"endTimestamp": 468,
241-
"op": "resource.css",
242-
"origin": "auto.resource.browser.metrics",
243-
"startTimestamp": 445,
238+
data: { "server.address": "example.com", "url.same_origin": true, "url.scheme": "https" },
244239
}),
245240
);
246241
});

0 commit comments

Comments
 (0)