Skip to content

Commit 316566e

Browse files
authored
fix: Update span op for outgoing HTTP requests (#3821)
We've established that incoming requests have op=http.server and outgoing requests have op=http.client. Specification available at: https://develop.sentry.dev/sdk/features/#http-client-integrations Last update: getsentry/develop#341
1 parent 75ae8c7 commit 316566e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/nextjs/test/integration/test/client/tracingFetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = async ({ page, url, requests }) => {
1717
{
1818
data: { method: 'GET', url: 'http://example.com', type: 'fetch' },
1919
description: 'GET http://example.com',
20-
op: 'http',
20+
op: 'http.client',
2121
},
2222
],
2323
});

packages/tracing/src/browser/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export function fetchCallback(
174174
type: 'fetch',
175175
},
176176
description: `${handlerData.fetchData.method} ${handlerData.fetchData.url}`,
177-
op: 'http',
177+
op: 'http.client',
178178
});
179179

180180
handlerData.fetchData.__span = span.spanId;
@@ -246,7 +246,7 @@ export function xhrCallback(
246246
url: xhr.url,
247247
},
248248
description: `${xhr.method} ${xhr.url}`,
249-
op: 'http',
249+
op: 'http.client',
250250
});
251251

252252
handlerData.xhr.__sentry_xhr_span_id__ = span.spanId;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('callbacks', () => {
143143
url: 'http://dogs.are.great/',
144144
});
145145
expect(newSpan!.description).toBe('GET http://dogs.are.great/');
146-
expect(newSpan!.op).toBe('http');
146+
expect(newSpan!.op).toBe('http.client');
147147
expect(fetchHandlerData.fetchData?.__span).toBeDefined();
148148

149149
const postRequestFetchHandlerData = {
@@ -233,7 +233,7 @@ describe('callbacks', () => {
233233
url: 'http://dogs.are.great/',
234234
});
235235
expect(newSpan!.description).toBe('GET http://dogs.are.great/');
236-
expect(newSpan!.op).toBe('http');
236+
expect(newSpan!.op).toBe('http.client');
237237
expect(xhrHandlerData.xhr!.__sentry_xhr_span_id__).toBeDefined();
238238
expect(xhrHandlerData.xhr!.__sentry_xhr_span_id__).toEqual(newSpan?.spanId);
239239

0 commit comments

Comments
 (0)