Skip to content

Conversation

@mlhv
Copy link
Contributor

@mlhv mlhv commented Jul 23, 2025

Added option to send report to Azure Blob Storage, as well as optionally notify a Teams Channel provided a webhook URL. If using the teams webhook alert, then an azure-subscription-id and azure-resource-group is required.

Users can use the following new flags when running the program:

  • --azurebloboutput "Blob Service SAS URL Here"
  • --teams-webhook "Teams Webhook URL Here"
  • --azure-subscription-id "Azure Subscription ID Here"
  • --azure-resource-group "Azure Resource Group Name Here"

Documentation is added to README.

@CLAassistant
Copy link

CLAassistant commented Jul 23, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link

coderabbitai bot commented Jul 23, 2025

Walkthrough

The changes introduce Azure Blob Storage export and Microsoft Teams notification integration for KRR reports. New configuration fields and CLI options are added to support Azure SAS URLs and Teams webhooks. The runner logic is extended to upload reports to Azure Blob Storage and notify Teams with adaptive cards containing report details and Azure Portal links. Documentation is updated accordingly.

Changes

File(s) Change Summary
README.md Added documentation for Azure Blob Storage export and Teams notification integration, including setup instructions and usage examples.
robusta_krr/core/models/config.py Added four optional string fields to the Config class for Azure/Teams integration.
robusta_krr/core/runner.py Extended output handling to support Azure Blob upload and Teams notifications; added helper methods for SAS URL parsing and notification.
robusta_krr/main.py Added four new CLI options and passed them to the configuration for Azure Blob/Teams integration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI (main.py)
    participant Runner
    participant Azure Blob Storage
    participant Microsoft Teams

    User->>CLI (main.py): Run KRR with Azure/Teams options
    CLI (main.py)->>Runner: Pass config with Azure SAS URL and Teams webhook
    Runner->>Runner: Generate report
    alt Azure Blob output enabled
        Runner->>Azure Blob Storage: Upload report file (HTTP PUT with SAS URL)
        alt Teams webhook configured
            Runner->>Microsoft Teams: Send adaptive card notification (webhook)
        end
    end
    Runner->>User: Complete execution
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 34955f6 and 8412c31.

📒 Files selected for processing (1)
  • robusta_krr/core/runner.py (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • robusta_krr/core/runner.py
✨ 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.

❤️ 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 generate unit tests to generate unit tests for 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
README.md (1)

685-761: Excellent comprehensive documentation for the new Azure Blob Storage and Teams integration.

The documentation is well-structured with clear prerequisites, setup instructions, usage examples, and feature descriptions. This will help users effectively utilize the new integration.

Note: Static analysis detected duplicate heading names ("Prerequisites" and "Setup") that appear in multiple sections. Consider making them more specific (e.g., "Azure Prerequisites", "Azure Setup") to improve navigation and avoid potential confusion.

robusta_krr/core/runner.py (1)

292-300: Consider improving the fallback behavior for missing Azure credentials.

The portal URL construction works correctly, but the fallback behavior when Azure subscription ID or resource group is missing still returns a URL that may not work properly.

Consider returning a more user-friendly fallback or logging a more specific warning:

-        if not settings.azure_subscription_id or not settings.azure_resource_group:
-            # Return a generic Azure portal link if specific info is missing
-            logger.warning("Azure subscription ID or resource group not provided. Azure portal link will not be specific.")
+        if not settings.azure_subscription_id or not settings.azure_resource_group:
+            logger.warning("Azure subscription ID or resource group not provided. Teams notification will include a generic Azure portal link.")
+            return "https://portal.azure.com/#blade/Microsoft_Azure_Storage/BrowseStorageBlade"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0c7119c and 34955f6.

⛔ Files ignored due to path filters (1)
  • images/krr_teams_example.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • README.md (3 hunks)
  • robusta_krr/core/models/config.py (1 hunks)
  • robusta_krr/core/runner.py (5 hunks)
  • robusta_krr/main.py (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

692-692: Multiple headings with the same content

(MD024, no-duplicate-heading)


698-698: Multiple headings with the same content

(MD024, no-duplicate-heading)

🪛 Ruff (0.12.2)
robusta_krr/core/runner.py

290-290: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

🔇 Additional comments (8)
robusta_krr/core/models/config.py (1)

72-75: LGTM! Clean integration of Azure Blob Storage and Teams notification configuration.

The new configuration fields follow the established patterns in the codebase and are properly typed with appropriate defaults.

README.md (1)

84-84: Good integration with existing documentation structure.

The addition to the integrations overview properly references the new Azure Blob and Teams integration, maintaining consistency with the existing documentation.

robusta_krr/core/runner.py (4)

15-15: Appropriate import addition for URL parsing functionality.

The urlparse import is correctly added to support the new SAS URL parsing functionality in the Azure integration methods.


119-146: Well-integrated Azure Blob Storage functionality in the output processing flow.

The integration of Azure blob upload follows the existing pattern used for other output methods. The logic correctly handles file creation, upload, Teams notification, and cleanup.


168-201: Solid implementation of Azure Blob Storage upload with proper error handling.

The method correctly handles:

  • File reading and HTTP PUT request to Azure
  • Content-Type mapping based on file extensions
  • SAS URL construction
  • Comprehensive error handling and logging

203-276: Comprehensive Teams notification implementation with rich adaptive cards.

The method creates a well-structured adaptive card with relevant metadata and includes proper error handling. The card format follows Microsoft Teams best practices.

robusta_krr/main.py (2)

269-292: Excellent CLI integration following established patterns.

The new command-line options are well-documented with clear help text and follow the existing naming conventions and categorization. The integration with the Config constructor is clean and consistent.


352-355: Proper integration of new parameters into Config constructor.

The new Azure-related parameters are correctly passed to the Config constructor, maintaining consistency with the existing parameter passing pattern.

aantn
aantn previously approved these changes Jul 24, 2025
Copy link
Contributor

@aantn aantn left a comment

Choose a reason for hiding this comment

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

Thank you!

@mlhv mlhv requested a review from aantn July 24, 2025 13:15
Copy link
Contributor

@arikalon1 arikalon1 left a comment

Choose a reason for hiding this comment

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

nice work

Thanks for this great PR @mlhv

@arikalon1 arikalon1 merged commit 87ce07a into robusta-dev:main Jul 24, 2025
2 checks passed
@mlhv mlhv deleted the feature/AzureBlobExport branch July 25, 2025 14:50
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.

4 participants