Add context and severity params to ExtendedLogger#isEnabled#7268
Add context and severity params to ExtendedLogger#isEnabled#7268jack-berg merged 2 commits intoopen-telemetry:mainfrom
Conversation
|
|
||
| /** 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.
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.
| @Override | ||
| public boolean isEnabled() { | ||
| public boolean isEnabled(Severity severity, Context context) { | ||
| return loggerEnabled; |
There was a problem hiding this comment.
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.82% 89.82%
- Complexity 6999 7002 +3
=========================================
Files 798 798
Lines 21199 21211 +12
Branches 2055 2055
=========================================
+ Hits 19042 19053 +11
Misses 1496 1496
- Partials 661 662 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…y-java into update-is-enabled-methods
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.