Repository navigation
feat(core): [Ignore HTTP Status 2] Add ignoredServerHttpStatusCodesForTracing configuration #6559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/ignore404-server-kind
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -598,6 +598,8 @@ public class SentryOptions implements RateLimiterConfig { | |
| */ | ||
| private @Nullable List<FilterString> ignoredTransactions = null; | ||
|
|
||
| private @Nullable List<HttpStatusCodeRange> ignoredServerHttpStatusCodesForTracing = null; | ||
|
|
||
| @ApiStatus.Experimental | ||
| private @NotNull IBackpressureMonitor backpressureMonitor = NoOpBackpressureMonitor.getInstance(); | ||
|
|
||
|
|
@@ -3147,6 +3149,34 @@ public void setIgnoredTransactions(final @Nullable List<String> ignoredTransacti | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the HTTP status codes and inclusive ranges for which incoming server transactions are | ||
| * not sent to Sentry. An empty list disables this filter. | ||
| * | ||
| * @return the configured HTTP status code ranges, or {@code null} if unset | ||
| */ | ||
| public @Nullable List<HttpStatusCodeRange> getIgnoredServerHttpStatusCodesForTracing() { | ||
| return ignoredServerHttpStatusCodesForTracing; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getter exposes internal mutable listMedium Severity
Triggered by learned rule: Ignored-filter getters return List of String Reviewed by Cursor Bugbot for commit 74bc19a. Configure here. |
||
|
|
||
| /** | ||
| * Sets the HTTP status codes and inclusive ranges for which incoming server transactions are not | ||
| * sent to Sentry. For example, configure {@code new HttpStatusCodeRange(404)} for one status or | ||
| * {@code new HttpStatusCodeRange(500, 599)} for an inclusive range. External configuration | ||
| * accepts comma-separated codes and ranges such as {@code 404,410,500-599}. An empty list | ||
| * disables this filter. | ||
| * | ||
| * @param ignoredServerHttpStatusCodesForTracing the HTTP status code ranges, or {@code null} to | ||
| * leave the option unset | ||
| */ | ||
| public void setIgnoredServerHttpStatusCodesForTracing( | ||
| final @Nullable List<HttpStatusCodeRange> ignoredServerHttpStatusCodesForTracing) { | ||
| this.ignoredServerHttpStatusCodesForTracing = | ||
| ignoredServerHttpStatusCodesForTracing == null | ||
| ? null | ||
| : new ArrayList<>(ignoredServerHttpStatusCodesForTracing); | ||
| } | ||
|
|
||
| /** Returns the current {@link SentryDateProvider} that is used to retrieve the current date. */ | ||
| @ApiStatus.Internal | ||
| public @NotNull SentryDateProvider getDateProvider() { | ||
|
|
@@ -3823,6 +3853,10 @@ public void merge(final @NotNull ExternalOptions options) { | |
| final List<String> ignoredTransactions = new ArrayList<>(options.getIgnoredTransactions()); | ||
| setIgnoredTransactions(ignoredTransactions); | ||
| } | ||
| if (options.getIgnoredServerHttpStatusCodesForTracing() != null) { | ||
| setIgnoredServerHttpStatusCodesForTracing( | ||
| options.getIgnoredServerHttpStatusCodesForTracing()); | ||
| } | ||
| if (options.getIgnoredErrors() != null) { | ||
| final List<String> ignoredExceptions = new ArrayList<>(options.getIgnoredErrors()); | ||
| setIgnoredErrors(ignoredExceptions); | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAML list integers fail conversion
Medium Severity
Spring Boot can bind this option from a YAML sequence, and unquoted codes such as
404arrive as integers while ranges such as500-599arrive as strings.HttpStatusCodeRangeonly offersvalueOf(String)and anintconstructor, so integer elements do not convert and context startup fail-fasts. Comma-separated string binding still works; other Sentry list properties accept YAML sequences.Reviewed by Cursor Bugbot for commit 74bc19a. Configure here.