Skip to content

Commit

Permalink
fix: Update span op for outgoing HTTP requests (#3821)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rhcarvalho authored Jul 20, 2021
1 parent 75ae8c7 commit 316566e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = async ({ page, url, requests }) => {
{
data: { method: 'GET', url: 'http://example.com', type: 'fetch' },
description: 'GET http://example.com',
op: 'http',
op: 'http.client',
},
],
});
Expand Down
4 changes: 2 additions & 2 deletions packages/tracing/src/browser/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export function fetchCallback(
type: 'fetch',
},
description: `${handlerData.fetchData.method} ${handlerData.fetchData.url}`,
op: 'http',
op: 'http.client',
});

handlerData.fetchData.__span = span.spanId;
Expand Down Expand Up @@ -246,7 +246,7 @@ export function xhrCallback(
url: xhr.url,
},
description: `${xhr.method} ${xhr.url}`,
op: 'http',
op: 'http.client',
});

handlerData.xhr.__sentry_xhr_span_id__ = span.spanId;
Expand Down
4 changes: 2 additions & 2 deletions packages/tracing/test/browser/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('callbacks', () => {
url: 'http://dogs.are.great/',
});
expect(newSpan!.description).toBe('GET http://dogs.are.great/');
expect(newSpan!.op).toBe('http');
expect(newSpan!.op).toBe('http.client');
expect(fetchHandlerData.fetchData?.__span).toBeDefined();

const postRequestFetchHandlerData = {
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('callbacks', () => {
url: 'http://dogs.are.great/',
});
expect(newSpan!.description).toBe('GET http://dogs.are.great/');
expect(newSpan!.op).toBe('http');
expect(newSpan!.op).toBe('http.client');
expect(xhrHandlerData.xhr!.__sentry_xhr_span_id__).toBeDefined();
expect(xhrHandlerData.xhr!.__sentry_xhr_span_id__).toEqual(newSpan?.spanId);

Expand Down

0 comments on commit 316566e

Please sign in to comment.