Modernize logger usage check#22351
Conversation
Accept a trailing throwable with parameters as opposed to requiring a clunkly lambda to use this syntax. Signed-off-by: Andrew Ross <andrross@amazon.com>
| public void onRejection(Exception e) { | ||
| holderToNotify.handler().handleRejection(e); | ||
| // if we get rejected during node shutdown we don't wanna bubble it up | ||
| logger.debug( |
There was a problem hiding this comment.
This class was arbitrarily chosen just to demonstrate the syntax the previous logger usage checked forced us to use and the simpler alternative.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22351 +/- ##
============================================
- Coverage 73.40% 73.39% -0.02%
- Complexity 76075 76096 +21
============================================
Files 6076 6076
Lines 345500 345490 -10
Branches 49732 49732
============================================
- Hits 253608 253565 -43
- Misses 71707 71731 +24
- Partials 20185 20194 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| private boolean isThrowable(Type type) { | ||
| return THROWABLE_CACHE.computeIfAbsent(type.getClassName(), className -> { | ||
| try { | ||
| Class<?> clazz = Class.forName(className, false, classLoader); |
There was a problem hiding this comment.
I'm trying to understand why we need to do all the convoluted logic with classloader here, is this because of the plugin ecosystem?
There was a problem hiding this comment.
It's because the final argument may be an exception type defined in the OpenSearch code base, so we need to be able to load those classes in order to do the check.
There was a problem hiding this comment.
Previously the check could operate with just the JDK and log4j classes on the classpath
Accept a trailing throwable with parameters as opposed to requiring a clunkly lambda to use this syntax.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.