-
Notifications
You must be signed in to change notification settings - Fork 913
Incubating: Add minimum severity and trace-based logger configuration #7529
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?
Incubating: Add minimum severity and trace-based logger configuration #7529
Conversation
…ers (#4612) Alternative to #4611 Some related prior discussions: - #4208 (comment) - #4207 (comment) Java POC @ open-telemetry/opentelemetry-java#7529 Declarative config for this is a bit nicer than in #4611, also supports applying different minimum severity levels to different loggers: ``` file_format: "1.0" logger_provider: logger_configurator/development: default_config: minimum_severity: WARN trace_based: true loggers: - name: "com.example.app.*" config: minimum_severity: INFO - name: "com.example.db.*" config: minimum_severity: ERROR ``` --------- Co-authored-by: Liudmila Molkova <[email protected]> Co-authored-by: Robert Pająk <[email protected]>
747bc91 to
f607dc9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7529 +/- ##
============================================
+ Coverage 90.17% 90.18% +0.01%
- Complexity 7189 7198 +9
============================================
Files 814 814
Lines 21730 21748 +18
Branches 2129 2132 +3
============================================
+ Hits 19594 19614 +20
- Misses 1467 1468 +1
+ Partials 669 666 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d8f0544 to
c471c04
Compare
c471c04 to
6d538c3
Compare
| /** Returns a disabled {@link LoggerConfig}. */ | ||
| public static LoggerConfig disabled() { | ||
| return DISABLED_CONFIG; | ||
| } | ||
|
|
||
| /** Returns an enabled {@link LoggerConfig}. */ | ||
| public static LoggerConfig enabled() { | ||
| return DEFAULT_CONFIG; | ||
| } |
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.
do we want to keep these shortcuts? I'd lean towards removing them to avoid confusion that passing one of them at runtime only enables/disables (as opposed to resetting all the properties)
| .onEmit(context, createLogRecord(context, observedTimestampEpochNanos)); | ||
| } | ||
|
|
||
| protected ReadWriteLogRecord createLogRecord(Context context, long observedTimestampEpochNanos) { |
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.
extracted this so don't need to add
if (!logger.isEnabled(severity, context)) {
return;
}
to ExtendedSdkLogRecordBuilder
(you can thank codecov for pointing out to me that there was no test coverage for it in the subclass 😄)
ff37f15 to
7131c10
Compare
7131c10 to
a88392e
Compare
Incubating implementation for open-telemetry/opentelemetry-specification#4612