Skip to content

Conversation

serhiy-yevtushenko
Copy link
Contributor

Description

Fix for the issue #237

Checklist

  • The patch has appropriate test coverage
  • The patch follows the style guidelines of this project
  • The patch has appropriate comments, particularly in hard-to-understand areas
  • The documentation was updated corresponding to the patch
  • I have performed a self-review of this patch

Copy link

coderabbitai bot commented Sep 2, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed mute timing deletion to use the correct operation, ensuring mute timings can be removed as expected via the API client and aligning behavior with the Grafana endpoint.
  • Tests

    • Added unit tests for deleting and retrieving mute timings to validate correct endpoint behavior and improve reliability.

Walkthrough

The delete_mute_timing operation now uses the HTTP DELETE method instead of GET in both async and sync alerting provisioning clients. Corresponding unit test added to exercise the DELETE request path. No signature or endpoint path changes; only the HTTP verb and test coverage updated.

Changes

Cohort / File(s) Summary
Async alerting provisioning client
grafana_client/elements/_async/alertingprovisioning.py
Change delete_mute_timing to call DELETE on /v1/provisioning/mute-timings/%s instead of GET.
Sync alerting provisioning client
grafana_client/elements/alertingprovisioning.py
Update delete_mute_timing to issue DELETE to /v1/provisioning/mute-timings/{mutetiming_name}; no signature changes.
Tests for alerting provisioning
test/elements/test_alertingprovisioning.py
Add unit test test_delete_mute_timing mocking a DELETE request and invoking delete_mute_timing; add test_get_mute_timing verifying GET behavior.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Caller
  participant Client as AlertingProvisioning
  participant HTTP as HTTP Client
  participant API as Grafana API

  Dev->>Client: delete_mute_timing(name)
  Client->>HTTP: DELETE /v1/provisioning/mute-timings/{name}
  HTTP->>API: DELETE /v1/provisioning/mute-timings/{name}
  API-->>HTTP: 200/204 (JSON/empty)
  HTTP-->>Client: Response
  Client-->>Dev: Result
  note over Client,HTTP: HTTP verb changed from GET to DELETE
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

A nibble of code, a hop to DELETE,
No more GETs where silence we meet.
Mute timings vanish with gentle grace,
Tests confirm the tidy place.
Thump-thump—ears up! Bug’s in retreat. 🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 006c30e and 90d0dab.

📒 Files selected for processing (3)
  • grafana_client/elements/_async/alertingprovisioning.py (1 hunks)
  • grafana_client/elements/alertingprovisioning.py (1 hunks)
  • test/elements/test_alertingprovisioning.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/elements/test_alertingprovisioning.py
  • grafana_client/elements/alertingprovisioning.py
  • grafana_client/elements/_async/alertingprovisioning.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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.
  • 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 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/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

codecov bot commented Sep 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.49%. Comparing base (755ef50) to head (90d0dab).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   92.27%   92.49%   +0.21%     
==========================================
  Files          27       27              
  Lines        1825     1825              
==========================================
+ Hits         1684     1688       +4     
+ Misses        141      137       -4     
Flag Coverage Δ
unittests 92.49% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@amotl amotl left a comment

Choose a reason for hiding this comment

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

Excellent, thank you again!

@serhiy-yevtushenko
Copy link
Contributor Author

How about releasing a new version of grafana-client with this fixes?

@amotl amotl merged commit 5b0df89 into grafana-toolbox:main Sep 2, 2025
7 checks passed
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