-
Notifications
You must be signed in to change notification settings - Fork 882
Add context and severity params to ExtendedLogger#isEnabled #7268
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: main
Are you sure you want to change the base?
Conversation
return true; | ||
} | ||
|
||
/** Overload of {@link #isEnabled(Severity, Context)} assuming {@link Context#current()}. */ | ||
default boolean isEnabled(Severity severity) { | ||
return isEnabled(severity, Context.current()); |
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.
The spec says this should accept Severity
and Context
parameters, but since we have implicit context in java, I think the most common case will be to use that. So I've included an overload where the context is omitted.
@@ -24,7 +26,7 @@ final class ExtendedSdkLogger extends SdkLogger implements ExtendedLogger { | |||
} | |||
|
|||
@Override | |||
public boolean isEnabled() { | |||
public boolean isEnabled(Severity severity, Context context) { | |||
return loggerEnabled; |
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.
Unfortunately there's no way for the java SDK to currently respond to context or severity parameters today until we also implement LogRecordProcessor#isEnabled: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logrecordprocessor-operations
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7268 +/- ##
============================================
+ Coverage 89.92% 89.97% +0.05%
- Complexity 6721 6729 +8
============================================
Files 765 765
Lines 20277 20289 +12
Branches 1985 1985
============================================
+ Hits 18234 18256 +22
+ Misses 1448 1439 -9
+ Partials 595 594 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #7242.
Also noticed that the noop implementations of isEnabled for traces, metrics, and logs were all returning true instead of false, so fixed that as well.