Skip to content

Commit

Permalink
ref: Remove old requestBodySize and responseBodySize fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Mar 23, 2023
1 parent 945781e commit 2cbc520
Show file tree
Hide file tree
Showing 22 changed files with 12 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ sentryTest('captures requestBody & responseBody when experiment is configured',
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 13,
responseBodySize: 14,
request: {
size: 13,
body: '{"foo":"bar"}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ sentryTest(
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 16,
responseBodySize: 24,
request: {
size: 16,
body: 'name=Anne&age=32',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ sentryTest('parses response_body_size from Content-Length header if available',
data: {
method: 'GET',
statusCode: 200,
responseBodySize: 789,
response: {
size: 789,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ sentryTest('does not capture response_body_size without Content-Length header',
data: {
method: 'GET',
statusCode: 200,
responseBodySize: 29,
response: {
size: 29,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ sentryTest('calculates body sizes for non-string bodies', async ({ getLocalTestP
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 26,
responseBodySize: 24,
request: {
size: 26,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
waitForReplayRequest,
} from '../../../../../utils/replayHelpers';

sentryTest('captures requestBodySize when body is sent', async ({ getLocalTestPath, page }) => {
sentryTest('captures request body size when body is sent', async ({ getLocalTestPath, page }) => {
if (shouldSkipReplayTest()) {
sentryTest.skip();
}
Expand Down Expand Up @@ -78,7 +78,6 @@ sentryTest('captures requestBodySize when body is sent', async ({ getLocalTestPa
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 13,
request: {
size: 13,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ sentryTest(
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 13,
responseBodySize: 14,
request: { size: 13, body: '{"foo":"bar"}' },
response: { size: 14, body: '{"res":"this"}' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ sentryTest(
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 16,
responseBodySize: 24,
request: { size: 16, body: 'name=Anne&age=32' },
response: { size: 24, body: '<html>Hello world</html>' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ sentryTest(
data: {
method: 'GET',
statusCode: 200,
responseBodySize: 789,
response: { size: 789 },
},
description: 'http://localhost:7654/foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ sentryTest(
data: {
method: 'GET',
statusCode: 200,
responseBodySize: 29,
response: { size: 29 },
},
description: 'http://localhost:7654/foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ sentryTest('calculates body sizes for non-string bodies', async ({ getLocalTestP
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 26,
responseBodySize: 24,
request: { size: 26 },
response: { size: 24 },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
waitForReplayRequest,
} from '../../../../../utils/replayHelpers';

sentryTest('captures requestBodySize when body is sent', async ({ getLocalTestPath, page, browserName }) => {
sentryTest('captures request body size when body is sent', async ({ getLocalTestPath, page, browserName }) => {
// These are a bit flaky on non-chromium browsers
if (shouldSkipReplayTest() || browserName !== 'chromium') {
sentryTest.skip();
Expand Down Expand Up @@ -82,7 +82,6 @@ sentryTest('captures requestBodySize when body is sent', async ({ getLocalTestPa
data: {
method: 'POST',
statusCode: 200,
requestBodySize: 13,
request: { size: 13 },
},
description: 'http://localhost:7654/foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ export const expectedFetchPerformanceSpan = {
data: {
method: 'POST',
statusCode: 200,
responseBodySize: 11,
requestBodySize: 3,
request: { size: 3 },
response: { size: 11 },
},
Expand All @@ -153,7 +151,6 @@ export const expectedXHRPerformanceSpan = {
data: {
method: 'GET',
statusCode: 200,
responseBodySize: 11,
response: { size: 11 },
},
};
Expand Down
7 changes: 3 additions & 4 deletions packages/replay/src/coreHandlers/handleFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ export function handleFetch(handlerData: HandlerDataFetch): null | ReplayPerform
return null;
}

const { method, request_body_size: requestBodySize, response_body_size: responseBodySize } = fetchData;
// This is only used as a fallback, so we know the body sizes are never set here
const { method, url } = fetchData;

return {
type: 'resource.fetch',
start: startTimestamp / 1000,
end: endTimestamp / 1000,
name: fetchData.url,
name: url,
data: {
method,
statusCode: response && (response as Response).status,
requestBodySize,
responseBodySize,
},
};
}
Expand Down
11 changes: 2 additions & 9 deletions packages/replay/src/coreHandlers/handleXhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ export function handleXhr(handlerData: HandlerDataXhr): ReplayPerformanceEntry |
return null;
}

const {
method,
url,
status_code: statusCode,
request_body_size: requestBodySize,
response_body_size: responseBodySize,
} = xhr.__sentry_xhr__;
// This is only used as a fallback, so we know the body sizes are never set here
const { method, url, status_code: statusCode } = xhr.__sentry_xhr__;

if (url === undefined) {
return null;
Expand All @@ -31,8 +26,6 @@ export function handleXhr(handlerData: HandlerDataXhr): ReplayPerformanceEntry |
data: {
method,
statusCode,
requestBodySize,
responseBodySize,
},
};
}
Expand Down
2 changes: 0 additions & 2 deletions packages/replay/src/coreHandlers/util/fetchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ async function _prepareFetchData(
url,
method,
statusCode: statusCode || 0,
requestBodySize,
responseBodySize,
request,
response,
};
Expand Down
14 changes: 1 addition & 13 deletions packages/replay/src/coreHandlers/util/networkUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,7 @@ export function makeNetworkReplayBreadcrumb(
return null;
}

const {
startTimestamp,
endTimestamp,
url,
method,
statusCode,
requestBodySize,
responseBodySize,
request,
response,
} = data;
const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data;

const result: ReplayPerformanceEntry & { data: object } = {
type,
Expand All @@ -108,8 +98,6 @@ export function makeNetworkReplayBreadcrumb(
data: dropUndefinedKeys({
method,
statusCode,
requestBodySize,
responseBodySize,
request,
response,
}),
Expand Down
2 changes: 0 additions & 2 deletions packages/replay/src/coreHandlers/util/xhrUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ function _prepareXhrData(
url,
method,
statusCode: statusCode || 0,
requestBodySize,
responseBodySize,
request,
response,
};
Expand Down
2 changes: 0 additions & 2 deletions packages/replay/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ export type ReplayNetworkRequestData = {
url: string;
method?: string;
statusCode: number;
requestBodySize?: number;
responseBodySize?: number;

request?: {
size?: number;
Expand Down
5 changes: 2 additions & 3 deletions packages/replay/test/unit/coreHandlers/handleFetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe('Unit | coreHandlers | handleFetch', () => {
expect(handleFetch(data)).toEqual(null);
});

it('passes request/response size through if available', function () {
// This cannot happen as of now, this test just shows the expected behavior
it('ignores request/response sizes', function () {
const data = {
...DEFAULT_DATA,
fetchData: {
Expand All @@ -58,8 +59,6 @@ describe('Unit | coreHandlers | handleFetch', () => {
expect(handleFetch(data)?.data).toEqual({
method: 'GET',
statusCode: 200,
requestBodySize: 123,
responseBodySize: 456,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
payload: {
data: {
method: 'GET',
requestBodySize: 10,
responseBodySize: 13,
statusCode: 200,
request: {
size: 10,
Expand Down Expand Up @@ -228,8 +226,6 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
payload: {
data: {
method: 'GET',
requestBodySize: 10,
responseBodySize: 13,
request: {
size: 10,
},
Expand Down Expand Up @@ -345,7 +341,6 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
payload: {
data: {
statusCode: 200,
responseBodySize: 13,
response: {
size: 13,
},
Expand Down Expand Up @@ -410,8 +405,6 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
payload: {
data: {
method: 'GET',
requestBodySize: 10,
responseBodySize: 13,
statusCode: 200,
request: {
size: 10,
Expand Down Expand Up @@ -540,8 +533,6 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
payload: {
data: {
method: 'GET',
requestBodySize: 10,
responseBodySize: 13,
statusCode: 200,
request: {
size: 10,
Expand Down
5 changes: 2 additions & 3 deletions packages/replay/test/unit/coreHandlers/handleXhr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ describe('Unit | coreHandlers | handleXhr', () => {
expect(handleXhr(data)).toEqual(null);
});

it('passes request/response size through if available', function () {
// This cannot happen as of now, this test just shows the expected behavior
it('ignores request/response sizes', function () {
const data: HandlerDataXhr = {
...DEFAULT_DATA,
xhr: {
Expand All @@ -54,8 +55,6 @@ describe('Unit | coreHandlers | handleXhr', () => {
expect(handleXhr(data)?.data).toEqual({
method: 'GET',
statusCode: 200,
requestBodySize: 123,
responseBodySize: 456,
});
});
});

0 comments on commit 2cbc520

Please sign in to comment.