Skip to content

Commit 0be545e

Browse files
committed
rename to maxIncomingRequestBodySize
1 parent 190903a commit 0be545e

File tree

10 files changed

+22
-18
lines changed

10 files changed

+22
-18
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Sentry.init({
66
release: '1.0',
77
tracesSampleRate: 1.0,
88
transport: loggingTransport,
9-
integrations: [Sentry.httpIntegration({ maxRequestBodySize: 'always' })],
9+
integrations: [Sentry.httpIntegration({ maxIncomingRequestBodySize: 'always' })],
1010
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Sentry.init({
66
release: '1.0',
77
tracesSampleRate: 1.0,
88
transport: loggingTransport,
9-
integrations: [Sentry.httpIntegration({ maxRequestBodySize: 'medium' })],
9+
integrations: [Sentry.httpIntegration({ maxIncomingRequestBodySize: 'medium' })],
1010
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Sentry.init({
88
transport: loggingTransport,
99
integrations: [
1010
Sentry.httpIntegration({
11-
maxRequestBodySize: 'none',
11+
maxIncomingRequestBodySize: 'none',
1212
ignoreIncomingRequestBody: url => url.includes('/ignore-request-body'),
1313
}),
1414
],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Sentry.init({
66
release: '1.0',
77
tracesSampleRate: 1.0,
88
transport: loggingTransport,
9-
integrations: [Sentry.httpIntegration({ maxRequestBodySize: 'small' })],
9+
integrations: [Sentry.httpIntegration({ maxIncomingRequestBodySize: 'small' })],
1010
});

dev-packages/node-integration-tests/suites/express/with-http/maxRequestBodySize/test.ts renamed to dev-packages/node-integration-tests/suites/express/with-http/maxIncomingRequestBodySize/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const MAX_GENERAL = 1024 * 1024; // 1MB
1212
const MAX_MEDIUM = 10_000;
1313
const MAX_SMALL = 1000;
1414

15-
describe('express with httpIntegration and not defined maxRequestBodySize', () => {
15+
describe('express with httpIntegration and not defined maxIncomingRequestBodySize', () => {
1616
afterAll(() => {
1717
cleanupChildProcesses();
1818
});
@@ -60,7 +60,7 @@ describe('express with httpIntegration and not defined maxRequestBodySize', () =
6060
});
6161
});
6262

63-
describe('express with httpIntegration and maxRequestBodySize: "none"', () => {
63+
describe('express with httpIntegration and maxIncomingRequestBodySize: "none"', () => {
6464
afterAll(() => {
6565
cleanupChildProcesses();
6666
});
@@ -127,7 +127,7 @@ describe('express with httpIntegration and maxRequestBodySize: "none"', () => {
127127
);
128128
});
129129

130-
describe('express with httpIntegration and maxRequestBodySize: "always"', () => {
130+
describe('express with httpIntegration and maxIncomingRequestBodySize: "always"', () => {
131131
afterAll(() => {
132132
cleanupChildProcesses();
133133
});
@@ -181,7 +181,7 @@ describe('express with httpIntegration and maxRequestBodySize: "always"', () =>
181181
);
182182
});
183183

184-
describe('express with httpIntegration and maxRequestBodySize: "small"', () => {
184+
describe('express with httpIntegration and maxIncomingRequestBodySize: "small"', () => {
185185
afterAll(() => {
186186
cleanupChildProcesses();
187187
});
@@ -256,7 +256,7 @@ describe('express with httpIntegration and maxRequestBodySize: "small"', () => {
256256
);
257257
});
258258

259-
describe('express with httpIntegration and maxRequestBodySize: "medium"', () => {
259+
describe('express with httpIntegration and maxIncomingRequestBodySize: "medium"', () => {
260260
afterAll(() => {
261261
cleanupChildProcesses();
262262
});

packages/node/src/integrations/http/SentryHttpInstrumentation.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export type SentryHttpInstrumentationOptions = InstrumentationConfig & {
7070
ignoreIncomingRequestBody?: (url: string, request: http.RequestOptions) => boolean;
7171

7272
/**
73-
* Controls the maximum size of HTTP request bodies attached to events.
73+
* Controls the maximum size of incoming HTTP request bodies attached to events.
7474
*
7575
* Available options:
7676
* - 'none': No request bodies will be attached
@@ -83,7 +83,7 @@ export type SentryHttpInstrumentationOptions = InstrumentationConfig & {
8383
*
8484
* @default 'medium'
8585
*/
86-
maxRequestBodySize?: 'none' | 'small' | 'medium' | 'always';
86+
maxIncomingRequestBodySize?: 'none' | 'small' | 'medium' | 'always';
8787

8888
/**
8989
* Whether the integration should create [Sessions](https://docs.sentry.io/product/releases/health/#sessions) for incoming requests to track the health and crash-free rate of your releases in Sentry.
@@ -242,7 +242,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
242242

243243
// eslint-disable-next-line @typescript-eslint/no-this-alias
244244
const instrumentation = this;
245-
const { ignoreIncomingRequestBody, maxRequestBodySize = 'medium' } = instrumentation.getConfig();
245+
const { ignoreIncomingRequestBody, maxIncomingRequestBodySize = 'medium' } = instrumentation.getConfig();
246246

247247
const newEmit = new Proxy(originalEmit, {
248248
apply(target, thisArg, args: [event: string, ...args: unknown[]]) {
@@ -263,8 +263,8 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
263263
const ipAddress = (request as { ip?: string }).ip || request.socket?.remoteAddress;
264264

265265
const url = request.url || '/';
266-
if (!ignoreIncomingRequestBody?.(url, request) && maxRequestBodySize !== 'none') {
267-
patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize);
266+
if (!ignoreIncomingRequestBody?.(url, request) && maxIncomingRequestBodySize !== 'none') {
267+
patchRequestToCaptureBody(request, isolationScope, maxIncomingRequestBodySize);
268268
}
269269

270270
// Update the isolation scope, isolate this request
@@ -372,7 +372,7 @@ function getBreadcrumbData(request: http.ClientRequest): Partial<SanitizedReques
372372
function patchRequestToCaptureBody(
373373
req: http.IncomingMessage,
374374
isolationScope: Scope,
375-
maxRequestBodySize: 'small' | 'medium' | 'always',
375+
maxIncomingRequestBodySize: 'small' | 'medium' | 'always',
376376
): void {
377377
let bodyByteLength = 0;
378378
const chunks: Buffer[] = [];
@@ -387,7 +387,11 @@ function patchRequestToCaptureBody(
387387
const callbackMap = new WeakMap();
388388

389389
const maxBodySize =
390-
maxRequestBodySize === 'small' ? 1_000 : maxRequestBodySize === 'medium' ? 10_000 : MAX_BODY_BYTE_LENGTH;
390+
maxIncomingRequestBodySize === 'small'
391+
? 1_000
392+
: maxIncomingRequestBodySize === 'medium'
393+
? 10_000
394+
: MAX_BODY_BYTE_LENGTH;
391395

392396
try {
393397
// eslint-disable-next-line @typescript-eslint/unbound-method

packages/node/src/integrations/http/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ interface HttpOptions {
9191
ignoreIncomingRequestBody?: (url: string, request: RequestOptions) => boolean;
9292

9393
/**
94-
* Controls the maximum size of HTTP request bodies attached to events.
94+
* Controls the maximum size of incoming HTTP request bodies attached to events.
9595
*
9696
* Available options:
9797
* - 'none': No request bodies will be attached
@@ -104,7 +104,7 @@ interface HttpOptions {
104104
*
105105
* @default 'medium'
106106
*/
107-
maxRequestBodySize?: 'none' | 'small' | 'medium' | 'always';
107+
maxIncomingRequestBodySize?: 'none' | 'small' | 'medium' | 'always';
108108

109109
/**
110110
* If true, do not generate spans for incoming requests at all.

0 commit comments

Comments
 (0)