Add azuremonitormetrics toolset & azuremonitorlogs toolset (both toolsets for CLI only)
- Add azure monitor metrics toolset for CLI
- Add azuremonitor logs toolset for CLI - Note : I have disabled azuremonitorlogs toolset for now, as it requires AzureMCP (which has removed SSE based activations from last release) where as HOlmes support only SSE . Once Holmes supports stdout, i will enable azuremonitor logs toolset in CLI by default.
- Also added azuremonitoraerts for investigate flows to investigate metric based alerts in azure monitor.
- All the tools use defaultcreds that requires login from az cli
- Added unit tests for azure monitor metrics & alerts (will add azuremonitorlogs tests in subsequent PRs when azuremonitorlogs get enabled)
Walkthrough
This update introduces comprehensive Azure Monitor integration for AKS clusters, adding new toolsets for Azure Monitor Metrics and Logs, complete with configuration, installation, and troubleshooting documentation. It implements new plugins for fetching and investigating Azure Monitor Prometheus metric alerts, extends the CLI with alert investigation commands, and provides diagnostic runbooks for systematic alert analysis. Extensive unit tests and documentation support these additions, alongside dependency updates and configuration examples.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Azure Monitor Metrics Toolset Implementationholmes/plugins/toolsets/azuremonitor_metrics/azuremonitor_metrics_toolset.py, holmes/plugins/toolsets/azuremonitor_metrics/utils.py, holmes/plugins/toolsets/azuremonitor_metrics/azuremonitor_metrics_instructions.jinja2, holmes/plugins/toolsets/azuremonitor_metrics/install.md, holmes/plugins/toolsets/azuremonitor_metrics/__init__.py |
Implements Azure Monitor Metrics toolset for querying managed Prometheus metrics on AKS clusters, including configuration, installation guide, utility functions for cluster/resource detection, LLM instructions, and module docstring. |
Azure Monitor Logs Toolset Implementationholmes/plugins/toolsets/azuremonitorlogs/azuremonitorlogs_toolset.py, holmes/plugins/toolsets/azuremonitorlogs/utils.py, holmes/plugins/toolsets/azuremonitorlogs/azuremonitorlogs_instructions.jinja2, holmes/plugins/toolsets/azuremonitorlogs/install.md, holmes/plugins/toolsets/azuremonitorlogs/__init__.py |
Adds Azure Monitor Logs toolset for AKS Container Insights detection and Log Analytics workspace integration, with configuration, installation, utilities for cluster/workspace detection, and instruction documentation. |
Azure Monitor Alerts Source Pluginholmes/plugins/sources/azuremonitoralerts/__init__.py |
Implements a new source plugin to fetch and process Azure Monitor Prometheus metric alerts for AKS clusters, converting them into Holmes issues with detailed query and description extraction. |
Runbooks for Azure Monitor & Kubernetes Troubleshootingholmes/plugins/runbooks/azuremonitor-alerts.yaml, holmes/plugins/runbooks/azure_monitor_logs_cost_optimization.md, holmes/plugins/runbooks/catalog.json, holmes/plugins/runbooks/networking/dns_troubleshooting_prometheus_instructions.md, holmes/plugins/runbooks/node_troubleshooting_prometheus_instructions.md, holmes/plugins/runbooks/pod_troubleshooting_prometheus_instructions.md, examples/azuremonitor_runbooks.yaml |
Adds YAML and Markdown runbooks for Azure Monitor alert diagnostics, cost optimization, and Kubernetes troubleshooting (DNS, node, pod issues), and updates the runbooks catalog. |
Documentation and GuidesAZURE_MONITOR_SETUP_GUIDE.md, docs/toolsets/azuremonitor-metrics.md, docs/toolsets/azuremonitor-logs.md, README.md, config.example.yaml |
Introduces setup, usage, and troubleshooting guides for Azure Monitor toolsets, updates README with new integrations, and extends configuration examples. |
Toolset and Core Integrationholmes/plugins/toolsets/__init__.py, holmes/core/toolset_manager.py |
Integrates new toolsets with conditional imports, availability checks, and special enable/disable logic for default toolsets. |
CLI and Investigation Enhancementsholmes/main.py, holmes/core/tool_calling_llm.py, holmes/core/runbooks.py |
Adds CLI command for Azure Monitor Prometheus alert investigation, improves runbook display in investigations, and introduces a method to retrieve matched runbooks with metadata. |
Dependency Updatespyproject.toml |
Adds azure-mgmt-resourcegraph dependency and updates azure-mgmt-resource version. |
Azure Monitor Metrics Toolset Teststests/plugins/toolsets/azuremonitor_metrics/test_azuremonitor_metrics_tools.py, tests/plugins/toolsets/azuremonitor_metrics/README.md |
Adds comprehensive unit tests and documentation for the Azure Monitor Metrics toolset, covering all tools, success/failure cases, and mocking strategies. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant CLI (holmes/main.py)
participant AzureMonitorAlertsSource
participant Azure API
participant Investigator
participant RunbookManager
User->>CLI (holmes/main.py): Run `azuremonitormetrics --alertid=...`
CLI (holmes/main.py)->>AzureMonitorAlertsSource: fetch_issue(alertid)
AzureMonitorAlertsSource->>Azure API: Query Alert Management API
Azure API-->>AzureMonitorAlertsSource: Return alert details
AzureMonitorAlertsSource-->>CLI (holmes/main.py): Return Issue object
CLI (holmes/main.py)->>Investigator: investigate(issue)
Investigator->>RunbookManager: get_matched_runbooks_for_issue(issue)
RunbookManager-->>Investigator: Return matched runbooks
Investigator-->>CLI (holmes/main.py): Investigation result
CLI (holmes/main.py)-->>User: Display analysis and runbook info
sequenceDiagram
participant HolmesGPT
participant AzureMonitorMetricsToolset
participant Azure API
participant AKS Cluster
HolmesGPT->>AzureMonitorMetricsToolset: Execute PromQL query
AzureMonitorMetricsToolset->>Azure API: Authenticate (Azure CLI/Managed Identity)
AzureMonitorMetricsToolset->>AKS Cluster: Detect cluster resource ID
AzureMonitorMetricsToolset->>Azure API: Query Prometheus endpoint
Azure API-->>AzureMonitorMetricsToolset: Return metrics/alerts
AzureMonitorMetricsToolset-->>HolmesGPT: Return results
Estimated code review effort
🎯 5 (Critical) | ⏱️ ~70 minutes
Suggested reviewers
- arikalon1
[!NOTE]
⚡️ Unit Test Generation is now available in beta!
Learn more here, or try it out under "Finishing Touches" below.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
🪧 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
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.
- PR comments: Tag
@coderabbitaiin 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.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.
@austonli @aritraghosh @pavneeta