Skip to content

perf: skip disabled log call-site resolution - #415

Open
goldyfruit wants to merge 3 commits into
OpenVoiceOS:devfrom
goldyfruit:perf/skip-disabled-debug-resolution
Open

perf: skip disabled log call-site resolution#415
goldyfruit wants to merge 3 commits into
OpenVoiceOS:devfrom
goldyfruit:perf/skip-disabled-debug-resolution

Conversation

@goldyfruit

@goldyfruit goldyfruit commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add LOG.is_enabled_for for named and numeric stdlib log levels
  • honor global logging.disable and resolve NOTSET through the effective root level
  • gate debug, info, warning, error, and exception before resolving the call-site logger
  • preserve the existing enabled logger path and unknown-level behavior

Why this layer

LOG._get_real_logger uses inspect.stack() for every call. Gating in ovos-utils removes that shared cost for every disabled severity instead of adding private checks to each caller. This does not change skill order, transformer behavior, message routing, or metrics ownership.

Validation

  • focused log suite: 15 passed, 10 subtests passed
  • Ruff clean on the touched files
  • git diff --check
  • the earlier full suite and 32-partition canary remained green at the previous head; the final all-level extension is a direct response to Jarbas review and is covered by the focused matrix

OpenVoiceOS/ovos-plugin-manager#427 is the coordinated high-volume consumer. No CI files were changed.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The logging utility now propagates levels to cached loggers, checks numeric and named levels, skips suppressed debug calls before stack inspection, and removes a fallback configuration import. Unit tests cover these behaviors.

Changes

Logging behavior

Layer / File(s) Summary
Logging controls and validation
ovos_utils/log.py, test/unittests/test_log.py
LOG.set_level updates cached loggers. LOG.is_enabled_for evaluates numeric and named levels. LOG.debug skips disabled records before logger resolution. The fallback log path no longer imports Configuration. Tests cover level checks and debug behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: jarbasal

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main performance change: skipping call-site resolution when debug logging is disabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ovos_utils/log.py`:
- Around line 138-152: Update LOG.is_enabled_for to honor
logging.root.manager.disable before evaluating the configured level, and when
LOG.level is logging.NOTSET, use the effective root logger level rather than
treating NOTSET as an enabled threshold. Add regression tests covering disabled
logging and NOTSET with DEBUG suppression, while preserving the existing
unknown-level behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 37f3f695-c5d1-47fe-a264-eee7ded306c0

📥 Commits

Reviewing files that changed from the base of the PR and between e8f1232 and 58da816.

📒 Files selected for processing (2)
  • ovos_utils/log.py
  • test/unittests/test_log.py

Comment thread ovos_utils/log.py
Comment thread ovos_utils/log.py
@goldyfruit goldyfruit changed the title perf: skip disabled debug call-site resolution perf: skip disabled log call-site resolution Aug 9, 2026
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.

2 participants