Skip to content

logs: add Enabled support to Logger API, SDK, and LogRecordProcessor#5380

Open
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:issue_5360
Open

logs: add Enabled support to Logger API, SDK, and LogRecordProcessor#5380
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:issue_5360

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Enabled chain from the OpenTelemetry Logs specification, closes #5360.

  • API Logger.enabled(context, severity_number, event_name) -> bool: non-abstract default returning True; NoOpLogger returns False; ProxyLogger delegates to the real logger.
  • SDK LogRecordProcessor.enabled(context, instrumentation_scope, severity_number, event_name) -> bool: non-abstract default returning True — processors opt into filtering by overriding this method.
  • SDK SynchronousMultiLogRecordProcessor / ConcurrentMultiLogRecordProcessor: enabled() returns False when no processors are registered, False when all processors return False, True otherwise.
  • SDK Logger.enabled(): checks LoggerConfig.is_enabled first, then delegates to the multi-processor with the logger's instrumentation scope.

Test plan

  • New SDK tests covering: no processors → False, processor present → True, disabled logger config → False, args forwarded to processor, all processors disabled → False, one processor enabled → True
  • New API tests covering: NoOpLogger.enabled()False, ProxyLogger.enabled() delegates to real logger, ProxyLogger.enabled() falls back to no-op

Implements the Enabled chain from the OpenTelemetry Logs specification:

- API Logger.enabled(context, severity_number, event_name) -> bool:
  default True; NoOpLogger returns False; ProxyLogger delegates.
- SDK LogRecordProcessor.enabled(...) -> bool: non-abstract default True
  so existing processors opt-in by overriding.
- SDK SynchronousMultiLogRecordProcessor/ConcurrentMultiLogRecordProcessor:
  enabled() returns False when no processors are registered, False when
  all processors return False, otherwise True.
- SDK Logger.enabled(): checks LoggerConfig.is_enabled first, then
  delegates to the multi-processor with the instrumentation scope.

Closes open-telemetry#5360
@ocelotl ocelotl marked this pull request as ready for review July 3, 2026 23:45
@ocelotl ocelotl requested a review from a team as a code owner July 3, 2026 23:45
…g fragment

Add pylint disable=no-self-use annotations to the enabled() default
implementations in the Logger API and LogRecordProcessor SDK base
classes, matching the existing pattern used for force_flush(). Also
add the missing .changelog/5380.added fragment required by the
changelog CI check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Logging stability review: [major] No Enabled support across API, SDK, and processors

1 participant