holmesgpt icon indicating copy to clipboard operation
holmesgpt copied to clipboard

ROB-1347: add more evals for the new logging API

Open nherment opened this issue 7 months ago • 2 comments

nherment avatar May 23 '25 11:05 nherment

[!CAUTION]

Review failed

The pull request is closed.

Walkthrough

The changes introduce a refactored approach to Kubernetes log fetching and processing, with structured log parsing, advanced filtering, and improved formatting. New utilities and tests support time conversion and log handling. Test infrastructure is enhanced to support conversation history and more detailed tool call tracking. Comprehensive fixtures and Helm manifests are added for robust integration and unit testing.

Changes

File(s) Change Summary
holmes/plugins/toolsets/kubernetes_logs.py Refactored log fetching to use a new StructuredLog data model, added advanced log parsing, filtering, and formatting; improved error handling and diagnostics.
holmes/plugins/toolsets/utils.py Added to_unix_ms function for converting timestamp strings to Unix milliseconds.
tests/plugins/toolsets/kubernetes/test_kubernetes_logs_mocked.py Centralized and streamlined Kubernetes log mocking via mock_k8s_read_log; updated tests to use this mock and adjusted assertions for new log outputs.
tests/plugins/toolsets/kubernetes/test_kubernetes_logs_unit.py Added new unit tests for log parsing and filtering, covering various scenarios and edge cases.
tests/plugins/toolsets/test_toolset_utils.py Refactored timestamp processing test; added tests for to_unix_ms.
tests/llm/test_ask_holmes.py Enhanced tool call output to include parameters; now passes conversation history to chat message builder.
tests/llm/utils/mock_utils.py Added support for loading conversation history in test cases; introduced conversation_history field and load_conversation_history function.
tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/conversation_history/... Added system and assistant markdown files for AI troubleshooting prompts and alert summaries.
tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/helm/sock-shop.yaml Added comprehensive Helm manifest for the "sock-shop" microservices demo application.
tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/*.txt, *.yaml Added various test fixture files simulating Kubernetes tool operations, log fetching, and alerting scenarios.
tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/conversation_history/... Added system prompt and assistant markdown for statefulset-related troubleshooting.
tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/helm/sock-shop.yaml Added Helm manifest for "sock-shop" in statefulset test scenario.
tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/test_case.yaml Added test case YAML for statefulset log retrieval scenario.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Toolset
    participant KubernetesAPI
    User->>Toolset: fetch_pod_logs(params)
    Toolset->>KubernetesAPI: fetch logs (current, timestamps)
    alt multiple containers
        Toolset->>KubernetesAPI: fetch logs for each container
    end
    Toolset->>KubernetesAPI: fetch previous logs (if needed)
    Toolset->>Toolset: parse_logs(raw_logs)
    Toolset->>Toolset: filter_logs(structured_logs, params)
    Toolset->>Toolset: format_logs(filtered_logs, display_container_name)
    Toolset-->>User: StructuredToolResult (logs or error)

Suggested labels

enhancement

Suggested reviewers

  • arikalon1

📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3986acbd93a2806b140ee4f444f1e78ebb66b4e and a664fb7dc15c4dffb6102ab587e8b61a5b6e6b3b.

📒 Files selected for processing (23)
  • holmes/plugins/toolsets/kubernetes_logs.py (7 hunks)
  • holmes/plugins/toolsets/utils.py (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/conversation_history/00_system.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/conversation_history/01_assistant.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/conversation_history/02_assistant.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/conversation_history/03_assistant.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/fetch_pod_logs.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/get_current_time.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/helm/sock-shop.yaml (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/kubectl_find_resource.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/kubectl_get_by_kind_in_namespace.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/kubectl_get_by_name.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/kubectl_lineage_children.txt (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/42_slack_deployment_logs/test_case.yaml (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/conversation_history/00_system.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/conversation_history/01_assistant.md (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/helm/sock-shop.yaml (1 hunks)
  • tests/llm/fixtures/test_ask_holmes/43_slack_statefulset_logs/test_case.yaml (1 hunks)
  • tests/llm/test_ask_holmes.py (2 hunks)
  • tests/llm/utils/mock_utils.py (3 hunks)
  • tests/plugins/toolsets/kubernetes/test_kubernetes_logs_mocked.py (7 hunks)
  • tests/plugins/toolsets/kubernetes/test_kubernetes_logs_unit.py (1 hunks)
  • tests/plugins/toolsets/test_toolset_utils.py (1 hunks)
✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 23 '25 11:05 coderabbitai[bot]

Results of HolmesGPT evals

Test suite Test case Status
ask_holmes 01_how_many_pods :warning:
ask_holmes 02_what_is_wrong_with_pod :white_check_mark:
ask_holmes 03_what_is_the_command_to_port_forward :white_check_mark:
ask_holmes 04_related_k8s_events :white_check_mark:
ask_holmes 05_image_version :white_check_mark:
ask_holmes 06_explain_issue :white_check_mark:
ask_holmes 07_high_latency :white_check_mark:
ask_holmes 08_sock_shop_frontend :white_check_mark:
ask_holmes 09_crashpod :white_check_mark:
ask_holmes 10_image_pull_backoff :white_check_mark:
ask_holmes 11_init_containers :white_check_mark:
ask_holmes 12_job_crashing :white_check_mark:
ask_holmes 13_pending_node_selector :white_check_mark:
ask_holmes 14_pending_resources :white_check_mark:
ask_holmes 15_failed_readiness_probe :white_check_mark:
ask_holmes 16_failed_no_toolset_found :white_check_mark:
ask_holmes 17_oom_kill :white_check_mark:
ask_holmes 18_crash_looping_v2 :white_check_mark:
ask_holmes 19_detect_missing_app_details :white_check_mark:
ask_holmes 20_long_log_file_search :x:
ask_holmes 21_job_fail_curl_no_svc_account :warning:
ask_holmes 22_high_latency_dbi_down :warning:
ask_holmes 23_app_error_in_current_logs :white_check_mark:
ask_holmes 24_misconfigured_pvc :white_check_mark:
ask_holmes 25_misconfigured_ingress_class :warning:
ask_holmes 26_multi_container_logs :white_check_mark:
ask_holmes 27_permissions_error_no_helm_tools :white_check_mark:
ask_holmes 28_permissions_error_helm_tools_enabled :white_check_mark:
ask_holmes 29_events_from_alert_manager :white_check_mark:
ask_holmes 30_basic_promql_graph_cluster_memory :white_check_mark:
ask_holmes 31_basic_promql_graph_pod_memory :white_check_mark:
ask_holmes 32_basic_promql_graph_pod_cpu :white_check_mark:
ask_holmes 33_http_latency_graph :white_check_mark:
ask_holmes 34_memory_graph :white_check_mark:
ask_holmes 35_tempo :white_check_mark:
ask_holmes 36_argocd_find_resource :white_check_mark:
ask_holmes 37_argocd_wrong_namespace :warning:
ask_holmes 38_rabbitmq_split_head :white_check_mark:
ask_holmes 39_failed_toolset :white_check_mark:
ask_holmes 40_disabled_toolset :white_check_mark:
ask_holmes 41_setup_argo :white_check_mark:
ask_holmes 42_slack_deployment_logs :x:
ask_holmes 43_slack_statefulset_logs :x:
investigate 01_oom_kill :white_check_mark:
investigate 02_crashloop_backoff :white_check_mark:
investigate 03_cpu_throttling :white_check_mark:
investigate 04_image_pull_backoff :white_check_mark:
investigate 05_crashpod :white_check_mark:
investigate 06_job_failure :white_check_mark:
investigate 07_job_syntax_error :warning:
investigate 08_memory_pressure :white_check_mark:
investigate 09_high_latency :white_check_mark:
investigate 10_kube_controller_manager_down :warning:
investigate 11_KubeDeploymentReplicasMismatch :white_check_mark:
investigate 12_KubePodCrashLooping :white_check_mark:
investigate 13_KubePodNotReady :white_check_mark:
investigate 14_Watchdog :white_check_mark:
investigate 15_tempo :white_check_mark:

Legend

  • :white_check_mark: the test was successful
  • :warning: the test failed but is known to be flakky or known to fail
  • :x: the test failed and should be fixed before merging the PR

github-actions[bot] avatar May 23 '25 11:05 github-actions[bot]