Skip to content

Commit 6bd2637

Browse files
authored
feat(tracing): Use http.method for span data (#7990)
1 parent 7163fdb commit 6bd2637

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/tracing-internal/src/browser/request.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export function fetchCallback(
195195
data: {
196196
...handlerData.fetchData,
197197
type: 'fetch',
198+
'http.method': handlerData.fetchData.method,
198199
},
199200
description: `${handlerData.fetchData.method} ${handlerData.fetchData.url}`,
200201
op: 'http.client',
@@ -334,7 +335,7 @@ export function xhrCallback(
334335
data: {
335336
...sentryXhrData.data,
336337
type: 'xhr',
337-
method: sentryXhrData.method,
338+
'http.method': sentryXhrData.method,
338339
url: sentryXhrData.url,
339340
},
340341
description: `${sentryXhrData.method} ${sentryXhrData.url}`,

packages/tracing-internal/test/browser/request.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('callbacks', () => {
7474

7575
const fetchSpan = {
7676
data: {
77-
method: 'GET',
77+
'http.method': 'GET',
7878
url: 'http://dogs.are.great/',
7979
type: 'fetch',
8080
},
@@ -156,7 +156,7 @@ describe('callbacks', () => {
156156
expect(newSpan).toBeDefined();
157157
expect(newSpan).toBeInstanceOf(Span);
158158
expect(newSpan.data).toEqual({
159-
method: 'GET',
159+
'http.method': 'GET',
160160
type: 'fetch',
161161
url: 'http://dogs.are.great/',
162162
});
@@ -220,7 +220,7 @@ describe('callbacks', () => {
220220

221221
const xhrSpan = {
222222
data: {
223-
method: 'GET',
223+
'http.method': 'GET',
224224
url: 'http://dogs.are.great/',
225225
type: 'xhr',
226226
},
@@ -295,7 +295,7 @@ describe('callbacks', () => {
295295

296296
expect(newSpan).toBeInstanceOf(Span);
297297
expect(newSpan.data).toEqual({
298-
method: 'GET',
298+
'http.method': 'GET',
299299
type: 'xhr',
300300
url: 'http://dogs.are.great/',
301301
});

0 commit comments

Comments
 (0)