From 316566ea52e2918d63429336c1ef943d9a674881 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Tue, 20 Jul 2021 21:44:26 +0200 Subject: [PATCH] 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: https://github.com/getsentry/develop/pull/341 --- packages/nextjs/test/integration/test/client/tracingFetch.js | 2 +- packages/tracing/src/browser/request.ts | 4 ++-- packages/tracing/test/browser/request.test.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nextjs/test/integration/test/client/tracingFetch.js b/packages/nextjs/test/integration/test/client/tracingFetch.js index 8f146f76aa47..265230286f33 100644 --- a/packages/nextjs/test/integration/test/client/tracingFetch.js +++ b/packages/nextjs/test/integration/test/client/tracingFetch.js @@ -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', }, ], }); diff --git a/packages/tracing/src/browser/request.ts b/packages/tracing/src/browser/request.ts index 8137a4c788f6..885d381017dc 100644 --- a/packages/tracing/src/browser/request.ts +++ b/packages/tracing/src/browser/request.ts @@ -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; @@ -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; diff --git a/packages/tracing/test/browser/request.test.ts b/packages/tracing/test/browser/request.test.ts index 7761f6a2660b..4c2a18788131 100644 --- a/packages/tracing/test/browser/request.test.ts +++ b/packages/tracing/test/browser/request.test.ts @@ -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 = { @@ -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);