Skip to content

Conversation

@trask
Copy link
Member

@trask trask commented Aug 6, 2025

Incubating implementation for open-telemetry/opentelemetry-specification#4612

github-merge-queue bot pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Sep 23, 2025
…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]>
@trask trask force-pushed the minimum-severity-and-trace-based-log-configuration branch from 747bc91 to f607dc9 Compare October 22, 2025 03:58
@trask trask changed the title POC Add minimum severity and trace-based logger configuration Incubating: Add minimum severity and trace-based logger configuration Oct 22, 2025
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (39e60f8) to head (a88392e).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trask trask force-pushed the minimum-severity-and-trace-based-log-configuration branch 3 times, most recently from d8f0544 to c471c04 Compare October 22, 2025 17:17
@trask trask force-pushed the minimum-severity-and-trace-based-log-configuration branch from c471c04 to 6d538c3 Compare October 22, 2025 17:36
Comment on lines 39 to 47
/** Returns a disabled {@link LoggerConfig}. */
public static LoggerConfig disabled() {
return DISABLED_CONFIG;
}

/** Returns an enabled {@link LoggerConfig}. */
public static LoggerConfig enabled() {
return DEFAULT_CONFIG;
}
Copy link
Member Author

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) {
Copy link
Member Author

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 😄)

@trask trask force-pushed the minimum-severity-and-trace-based-log-configuration branch from ff37f15 to 7131c10 Compare October 22, 2025 19:31
@trask trask force-pushed the minimum-severity-and-trace-based-log-configuration branch from 7131c10 to a88392e Compare October 22, 2025 19:34
@trask trask marked this pull request as ready for review October 22, 2025 19:58
@trask trask requested a review from a team as a code owner October 22, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant