holmesgpt icon indicating copy to clipboard operation
holmesgpt copied to clipboard

mute logging toolset status for console

Open mainred opened this issue 2 months ago โ€ข 2 comments

To avoid printing the lengthy toolset status, we mute the status for console, since we have /tools to print the toolset status. Also, we unform the output for both using and not using toolset.

With cache

Loaded models: ['azure/gpt-5-mini']
Loading toolsets...
Refreshing available datasources (toolsets)
Toolset statuses are cached to /home/azureuser/.holmes/toolsets_status.json
Using 44 datasources (toolsets). To view all available toolsets: run '/tools'. To refresh: use flag `--refresh-toolsets`
Using model: azure/gpt-5-mini (272,000 total tokens, 54,400 output tokens)
Welcome to HolmesGPT: Type '/exit' to exit, '/help' for commands.

Without cache

Loaded models: ['azure/gpt-5-mini']
Loading toolsets...
Using 44 datasources (toolsets). To view all available toolsets: run '/tools'. To refresh: use flag `--refresh-toolsets`
Using model: azure/gpt-5-mini (272,000 total tokens, 54,400 output tokens)
Welcome to HolmesGPT: Type '/exit' to exit, '/help' for commands.

mainred avatar Oct 31 '25 06:10 mainred

Walkthrough

Adds a mute_log_status flag to Toolset.check_prerequisites and threads it through ToolsetManager methods to optionally suppress prerequisite logging; renames load_toolset_with_status to load_console_toolset_with_status; downgrades some service/prometheus discovery logs to debug; minor CLI string-slicing whitespace fixes and test updates for the renamed method.

Changes

Cohort / File(s) Summary
Core toolset prerequisite handling
holmes/core/tools.py
Added parameter mute_log_status: bool = False to Toolset.check_prerequisites(). Logging paths updated to suppress failure/success messages when muted. Added/adjusted imports related to transformers and config merging.
Toolset manager infrastructure
holmes/core/toolset_manager.py
Threaded mute_log_status through _list_all_toolsets(), check_toolset_prerequisites(), and refresh_toolset_status(); renamed load_toolset_with_status() โ†’ load_console_toolset_with_status() and updated internal call sites and log messages; ensured cached loads run prerequisite checks with mute flag where required.
Interactive CLI parsing
holmes/interactive.py
Fixed minor whitespace in slash-command argument slicing for /show and /run parsing (removed stray space in slice expressions).
Plugin toolsets logging & imports
holmes/plugins/toolsets/prometheus/prometheus.py, holmes/plugins/toolsets/service_discovery.py
Changed some discovery log messages from INFO to DEBUG. Reorganized/clarified imports and metadata comments in Prometheus plugin.
Tests
tests/core/test_toolset_manager.py
Updated tests to use load_console_toolset_with_status() (renamed from load_toolset_with_status) and adjusted patched targets/expectations accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ToolsetManager
    participant Toolset
    participant Logger

    Note over Caller,ToolsetManager: High-level prerequisite flow with optional log suppression

    Caller->>ToolsetManager: check_toolset_prerequisites(toolsets, mute_log_status=bool)
    ToolsetManager->>Toolset: check_prerequisites(mute_log_status=bool)
    alt mute_log_status = true
        Toolset->>Toolset: Evaluate prerequisites (no status logs)
        Note right of Logger: Logging suppressed for failures/success
    else mute_log_status = false
        Toolset->>Logger: Log prerequisite failures/success
    end
    Toolset-->>ToolsetManager: result/status
    ToolsetManager-->>Caller: aggregated status

Estimated code review effort

๐ŸŽฏ 3 (Moderate) | โฑ๏ธ ~20 minutes

  • Areas to focus on:
    • Verify mute_log_status is consistently passed through all call paths in toolset_manager.py and callers.
    • Confirm the rename load_console_toolset_with_status is applied everywhere (including tests/mocks) and doesn't break external integrations.
    • Check logging level changes in plugin files for any monitoring/observability expectations.
    • Review the new imports in tools.py for unused or circular import risks.

Possibly related PRs

  • robusta-dev/holmesgpt#535 โ€” modifies ToolsetManager toolset loading and prerequisite handling (closely related to load/check flow changes).
  • robusta-dev/holmesgpt#909 โ€” adjusts cached-toolset gating and prerequisite execution; touches similar code paths.
  • robusta-dev/holmesgpt#450 โ€” changes around Toolset.check_prerequisites, including related logging and error handling.

Suggested reviewers

  • nherment
  • moshemorad
  • aantn

Pre-merge checks and finishing touches

โŒ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage โš ๏ธ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
โœ… Passed checks (2 passed)
Check name Status Explanation
Title Check โœ… Passed The pull request title "mute logging toolset status for console" is directly related to the main objective and primary changes in the changeset. The changes across multiple files consistently implement the capability to suppress (mute) log output for toolset status when operating in a console context, evidenced by the addition of the mute_log_status parameter, the renaming of methods to be console-specific (e.g., load_console_toolset_with_status), and the reworking of log messages to reference console-focused usage. The title is concise, clear, and specific enough for a developer scanning history to understand that this PR addresses logging verbosity for console toolset status output.
Description Check โœ… Passed The PR description clearly relates to the changeset. It explains the motivation (muting lengthy toolset status output because /tools command provides that information) and the implementation approach (adding mute_log_status parameter to suppress logging and renaming methods to console-specific variants like load_console_toolset_with_status). The description includes concrete before/after output examples demonstrating the normalized console output for both cached and non-cached scenarios, which directly corresponds to the changes made throughout holmes/core/tools.py, holmes/core/toolset_manager.py, and related test files. The description is sufficiently specific and on-topic.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch toolset-loading-lengthy

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 and usage tips.

coderabbitai[bot] avatar Oct 31 '25 06:10 coderabbitai[bot]

Results of HolmesGPT evals

  • ask_holmes: 34/36 test cases were successful, 1 regressions, 1 setup failures
Test suite Test case Status
ask 01_how_many_pods :white_check_mark:
ask 02_what_is_wrong_with_pod :white_check_mark:
ask 04_related_k8s_events :white_check_mark:
ask 05_image_version :white_check_mark:
ask 09_crashpod :white_check_mark:
ask 10_image_pull_backoff :white_check_mark:
ask 110_k8s_events_image_pull :white_check_mark:
ask 11_init_containers :white_check_mark:
ask 13a_pending_node_selector_basic :white_check_mark:
ask 14_pending_resources :white_check_mark:
ask 15_failed_readiness_probe :white_check_mark:
ask 17_oom_kill :white_check_mark:
ask 18_oom_kill_from_issues_history :white_check_mark:
ask 19_detect_missing_app_details :white_check_mark:
ask 20_long_log_file_search :x:
ask 24_misconfigured_pvc :white_check_mark:
ask 24a_misconfigured_pvc_basic :white_check_mark:
ask 28_permissions_error :construction:
ask 39_failed_toolset :white_check_mark:
ask 41_setup_argo :white_check_mark:
ask 42_dns_issues_steps_new_tools :white_check_mark:
ask 43_current_datetime_from_prompt :white_check_mark:
ask 45_fetch_deployment_logs_simple :white_check_mark:
ask 51_logs_summarize_errors :white_check_mark:
ask 53_logs_find_term :white_check_mark:
ask 54_not_truncated_when_getting_pods :white_check_mark:
ask 59_label_based_counting :white_check_mark:
ask 60_count_less_than :white_check_mark:
ask 61_exact_match_counting :white_check_mark:
ask 63_fetch_error_logs_no_errors :white_check_mark:
ask 79_configmap_mount_issue :white_check_mark:
ask 83_secret_not_found :white_check_mark:
ask 86_configmap_like_but_secret :white_check_mark:
ask 93_calling_datadog[0] :white_check_mark:
ask 93_calling_datadog[1] :white_check_mark:
ask 93_calling_datadog[2] :white_check_mark:

Legend

  • :white_check_mark: the test was successful
  • :minus: the test was skipped
  • :warning: the test failed but is known to be flaky or known to fail
  • :construction: the test had a setup failure (not a code regression)
  • :wrench: the test failed due to mock data issues (not a code regression)
  • :no_entry_sign: the test was throttled by API rate limits/overload
  • :x: the test failed and should be fixed before merging the PR

github-actions[bot] avatar Oct 31 '25 07:10 github-actions[bot]