Skip to content

feat(core): [Ignore HTTP Status 2] Add ignoredServerHttpStatusCodesForTracing configuration - #6559

Open
adinauer wants to merge 2 commits into
feat/ignore404-server-kindfrom
feat/ignore404-options
Open

adinauer wants to merge 2 commits into
feat/ignore404-server-kindfrom
feat/ignore404-options

Conversation

@adinauer

@adinauer adinauer commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Ignore HTTP Status)


📜 Description

Add the nullable ignoredServerHttpStatusCodesForTracing option without changing tracing behavior or configuring any default ignored status codes.

The option accepts HttpStatusCodeRange values through Java. External configuration accepts comma-separated status codes and inclusive ranges such as 404,410,500-599 through sentry.properties, JVM system properties, and environment variables. Missing values preserve existing programmatic configuration, while an explicit empty value clears the list.

Spring Boot configuration binding is covered across all three supported Spring Boot modules. A shared HttpStatusCodeRange.valueOf(String) parser keeps Spring and external parsing consistent and validates HTTP status codes within 100-599.

💡 Motivation and Context

This is the configuration layer for #4735. It intentionally does not consume the option yet, so incoming HTTP transactions continue to be traced exactly as before. The next PR adds opt-in filtering for configured status codes.

Malformed external entries are logged and ignored without aborting SDK initialization. Mixed valid and invalid values retain the valid ranges, and an all-invalid non-empty value does not clear existing configuration. Spring Boot retains its normal fail-fast configuration binding behavior for invalid values.

Refs #4735

💚 How did you test it?

  • HttpStatusCodeRangeTest, ExternalOptionsTest, and SentryOptionsTest
  • SentryAutoConfigurationTest in sentry-spring-boot, sentry-spring-boot-jakarta, and sentry-spring-boot-4
  • Spotless formatting and checks for affected modules
  • :sentry:checkKotlinAbi
  • Verified generated Spring configuration metadata in all three Spring Boot modules

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

The next PR filters configured incoming server HTTP statuses in SentryClient while preserving the current default behavior.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into 9.x.x.

Add an unset option for ignored incoming server HTTP status codes and ranges.
Parse external configuration without clearing existing values when all entries
are invalid, and support Spring Boot binding across all supported versions.

This PR only adds configuration surfaces; filtering remains unchanged.

Refs #4735
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 74bc19a

@sentry

sentry Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.63.0 (1) release

⚙️ sentry-android Build Distribution Settings

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 74bc19a. Configure here.

*/
public @Nullable List<HttpStatusCodeRange> getIgnoredServerHttpStatusCodesForTracing() {
return ignoredServerHttpStatusCodesForTracing;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getter exposes internal mutable list

Medium Severity

getIgnoredServerHttpStatusCodesForTracing() returns the internal list instead of a copy. Callers can add, remove, or clear ranges without the setter, so later reads can disagree with what was configured. Other ignored-* getters return a copy for this reason, and changing that later would be a public API behavior change.

Fix in Cursor Fix in Web

Triggered by learned rule: Ignored-filter getters return List of String

Reviewed by Cursor Bugbot for commit 74bc19a. Configure here.

throw invalidRange(value);
}
return new HttpStatusCodeRange(min, max);
}

Copy link
Copy Markdown

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 404 arrive as integers while ranges such as 500-599 arrive as strings. HttpStatusCodeRange only offers valueOf(String) and an int constructor, so integer elements do not convert and context startup fail-fasts. Comma-separated string binding still works; other Sentry list properties accept YAML sequences.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 74bc19a. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant