-
Notifications
You must be signed in to change notification settings - Fork 33
Discard classes as patterns #248
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: integration/uplift-2025
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR implements pattern matching support for the discardClasses configuration in Bugsnag, allowing users to filter exception classes using glob-style wildcards (* and ?) in addition to exact matches.
Key changes:
- Enhanced
Configuration.shouldIgnoreClass()to support wildcard pattern matching using compiled regex patterns - Maintained backward compatibility with exact class name matching
- Added comprehensive test coverage for pattern matching scenarios
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| bugsnag/src/main/java/com/bugsnag/Configuration.java | Core implementation of pattern matching logic with regex conversion and pattern storage |
| bugsnag/src/test/java/com/bugsnag/ConfigurationDiscardClassesTest.java | Unit tests covering exact matches, wildcards, multiple patterns, and edge cases |
| features/fixtures/scenarios/src/main/java/com/bugsnag/mazerunner/scenarios/MultipleWildcardPatternsScenario.java | Integration test scenario for multiple wildcard patterns |
| features/fixtures/scenarios/src/main/java/com/bugsnag/mazerunner/scenarios/IgnoredExceptionWildcardScenario.java | Integration test scenario for wildcard-based exception filtering |
| features/multiple_wildcard_patterns.feature | Feature test for multiple wildcard patterns functionality |
| features/ignored_reports_wildcard.feature | Feature tests for wildcard pattern filtering across different app types |
| features/fixtures/logback/ignored_class_wildcard_config.xml | Logback configuration example demonstrating wildcard usage |
| DISCARD_CLASSES_PATTERN_MATCHING.md | Documentation for the new pattern matching feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...enarios/src/main/java/com/bugsnag/mazerunner/scenarios/IgnoredExceptionWildcardScenario.java
Outdated
Show resolved
Hide resolved
…er/scenarios/IgnoredExceptionWildcardScenario.java Co-authored-by: Copilot <[email protected]>
…-java into discardClassesAsPatterns
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.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request enhances the Bugsnag Java notifier to allow ignoring exception classes using Java regex patterns, enabling more flexible and powerful filtering of exceptions. The change replaces the previous exact string matching with regex-based matching for discarded exception classes, updates the configuration and API accordingly, and adds comprehensive tests and scenarios for wildcard and multiple pattern support.
Regex-based exception class filtering:
setDiscardClassesAPI inBugsnagandConfigurationnow accepts compiledPatternobjects instead of strings, allowing users to specify regex patterns for exception class names to ignore. This enables wildcard and pattern-based filtering instead of only exact matches. [1] [2]shouldIgnoreClasslogic inConfigurationis updated to match exception class names using the provided regex patterns.BugsnagAppenderis updated to compile string patterns toPatternobjects before passing them toBugsnag, ensuring compatibility with the new API. [1] [2]Testing and validation:
ConfigurationDiscardClassesTest, is added to cover various regex matching scenarios, including wildcards, multiple patterns, special characters, and empty/null patterns.BugsnagTestandAppenderTestare updated to use and validate the new regex-based API. [1] [2]Feature scenarios and configuration:
IgnoredExceptionWildcardScenario,MultipleWildcardPatternsScenario) and logback configuration are provided to demonstrate and test the new regex-based discard functionality. [1] [2] [3]Supporting code changes:
Configurationare updated to store and serialize both the compiledPatternobjects and their string representations for backward compatibility and configuration introspection. [1] [2]These changes significantly improve the flexibility of exception filtering in Bugsnag Java integrations, making it easier to ignore groups of exceptions using patterns.
References: [1] [2] [3] [4] [5]