Skip to content

Commit 162f0d4

Browse files
fix: Update request size thresholds to match other SDKs (#4177)
Changed the threshold for small request bodies from 1k to 4k to align with other SDKs (per [the docs](https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/configuration/options/#max-request-body-size)).
1 parent 4838660 commit 162f0d4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Redact Authorization headers before sending events to Sentry ([#4164](https://github.com/getsentry/sentry-dotnet/pull/4164))
88
- Remove Strong Naming from Sentry.Hangfire ([#4099](https://github.com/getsentry/sentry-dotnet/pull/4099))
9+
- Increase `RequestSize.Small` threshold from 1 kB to 4 kB to match other SDKs ([#4177](https://github.com/getsentry/sentry-dotnet/pull/4177))
910

1011
### Features
1112

src/Sentry.AspNetCore.Grpc/ProtobufRequestExtractionDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public ProtobufRequestExtractionDispatcher(IEnumerable<IProtobufRequestPayloadEx
4646

4747
switch (size)
4848
{
49-
case RequestSize.Small when request.ContentLength < 1_000:
49+
case RequestSize.Small when request.ContentLength < 4_000:
5050
case RequestSize.Medium when request.ContentLength < 10_000:
5151
case RequestSize.Always:
5252
_options.Log(SentryLevel.Debug,

src/Sentry/Extensibility/RequestBodyExtractionDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public RequestBodyExtractionDispatcher(IEnumerable<IRequestPayloadExtractor> ext
4242

4343
switch (size)
4444
{
45-
case RequestSize.Small when request.ContentLength < 1_000:
45+
case RequestSize.Small when request.ContentLength < 4_000:
4646
case RequestSize.Medium when request.ContentLength < 10_000:
4747
case RequestSize.Always:
4848
_options.LogDebug("Attempting to read request body of size: {0}, configured max: {1}.",

test/Sentry.Tests/Extensibility/RequestBodyExtractionDispatcherTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public void ExtractPayload_ExtractorNull_ReturnsNull()
5151

5252
[Theory]
5353
[InlineData(RequestSize.None, 1, false)]
54-
[InlineData(RequestSize.Small, 999, true)]
55-
[InlineData(RequestSize.Small, 10_000, false)]
54+
[InlineData(RequestSize.Small, 3_999, true)]
55+
[InlineData(RequestSize.Small, 4_000, false)]
5656
[InlineData(RequestSize.Medium, 9999, true)]
57-
[InlineData(RequestSize.Medium, 100_000, false)]
57+
[InlineData(RequestSize.Medium, 10_000, false)]
5858
[InlineData(RequestSize.Always, int.MaxValue, true)] // 2 GB event? No problem...
5959
public void ExtractPayload_RequestSizeSmall_ContentLength(RequestSize requestSize, int contentLength, bool readBody)
6060
{

0 commit comments

Comments
 (0)