Skip to content

oss_22_logger_enabled #22

Closed
Closed

Description

@ocelotl

Logs API/SDK: add the Logger.enabled(context, severity_number, event_name) operation (Linear OSS-22, finding L3).

Branch / worktree: oss_22_logger_enabled

Linear issue: https://linear.app/dash0/issue/OSS-22/l3-logs-apisdk-missing-the-loggerenabled-operation

Activity

  1. ocelotl commented on Jul 22, 2026

    @ocelotl
    OwnerAuthor

    🔒 Internal (dash0) — not for upstream.

    Tracking for the Logs API/SDK Logger.enabled operation.

  2. ocelotl commented on Jul 22, 2026

    @ocelotl
    OwnerAuthor

    📣 Public-facing draft — to be opened upstream in open-telemetry/opentelemetry-python. No internal references; copy verbatim.

    Title: Logs API/SDK: Logger is missing the public Enabled operation

    Description

    The Logs API Logger has no public Enabled operation, and the SDK Logger only exposes a private, parameter-less _is_enabled() that ignores context, severity, and event name.

    Evidence:

    • API Logger (opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py) defines emit(...) but no enabled method.
    • SDK Logger._is_enabled() (opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py) returns only self._logger_config.is_enabled, taking no arguments.

    Spec

    Logs API, "Logger's Enabled Operation": accepts the LogRecord Context (optional, implicit context), Severity Number (optional), and Event Name (optional), and MUST return a language-idiomatic boolean — true = enabled for the arguments. It is an optional performance optimization so callers can avoid constructing a LogRecord that would be dropped.

    Reference

    • Go: sdk/log/logger.go — Enabled(ctx, log.EnabledParameters) bool, returning true if any processor is enabled; the Go no-op logger returns false.
    • Java: Logger.isEnabled(...).

    Proposed fix

    Add a public enabled(context=None, severity_number=None, event_name=None) -> bool to the API Logger (no-op default False) and implement it in the SDK Logger, delegating to a processor-level Enabled hook (any-enabled wins; disabled when no processors) while honoring the logger configuration.

  3. ocelotl commented on Sep 8, 2026

    @ocelotl
    OwnerAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions