Skip to content

ACLP clone alert definition and addition of group by field in alerting APIs#704

Open
shkaruna wants to merge 12 commits into
linode:devfrom
shkaruna:feat/clone_and_group_by
Open

ACLP clone alert definition and addition of group by field in alerting APIs#704
shkaruna wants to merge 12 commits into
linode:devfrom
shkaruna:feat/clone_and_group_by

Conversation

@shkaruna

@shkaruna shkaruna commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

📝 Description

This PR adds support for the group_by field on ACLP Monitor Alert Definitions and introduces a clone API operation, along with unit/integration tests.

Changes:
Add GroupBy (group_by) to alert definition class.
Add clone_alert_definition API.
Expand unit/integration tests and fixtures to cover group_by and cloning.

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?
Not applicable

How do I run the relevant unit/integration tests?

Prerequisites:
Clone the repository
Prepare environment (zsh / macOS)

Create and activate venv:
python3 -m venv .venv
source .venv/bin/activate

install deps
python -m pip install --upgrade pip

Install runtime dependencies:
pip3 install requests polling deprecated

Install dev/test extras
pip3 install -e '.[dev,test]'

test deps
pip3 install pytest mock httpretty pytest-rerunfailures

Unit tests:

Run all unit tests:
python -m pytest test/unit -q

Run Monitor alert definition unit tests:
python -m pytest test/unit/groups/monitor_api_test.py -q -s -v

Integration tests:

python -m pytest test/integration/models/monitor/test_monitor.py::test_integration_clone_alert_definition -q -s

python -m pytest test/integration/models/monitor/test_monitor.py::test_integration_create_get_update_delete_alert_definition -q -s

Comment thread test/fixtures/monitor_services_dbaas_alert-definitions_12345_clone.json Outdated
Comment thread test/fixtures/monitor_services_dbaas_alert-definitions_12345_clone.json Outdated
Comment thread test/integration/models/monitor/test_monitor.py
@shkaruna shkaruna force-pushed the feat/clone_and_group_by branch from 21396ef to b957929 Compare June 9, 2026 04:56
@shkaruna shkaruna force-pushed the feat/clone_and_group_by branch from b957929 to 3527e51 Compare June 9, 2026 07:22

@satkumar-akamai satkumar-akamai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@shkaruna shkaruna marked this pull request as ready for review June 9, 2026 07:29
@shkaruna shkaruna requested review from a team as code owners June 9, 2026 07:29
@shkaruna shkaruna requested review from ezilber-akamai and psnoch-akamai and removed request for a team June 9, 2026 07:29
@shkaruna shkaruna changed the title Feat/clone and group by ACLP clone alert definition and addition of group by field in alerting APIs Jun 9, 2026
@yec-akamai yec-akamai added new-feature for new features in the changelog. community-contribution for contributions made by a non-DX author labels Jun 17, 2026

@yec-akamai yec-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! Just a small suggestion:

Comment thread linode_api4/groups/monitor.py Outdated
The clone request creates a new alert definition based on the source
definition identified by ``id``.

API URL: POST /monitor/services/{service_type}/alert-definitions/{id}/clone

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: we usually don't put the api url in the docstring.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the API URL

yec-akamai
yec-akamai previously approved these changes Jun 17, 2026
@yec-akamai yec-akamai self-requested a review June 17, 2026 20:27
@yec-akamai

Copy link
Copy Markdown
Contributor

To fix the lint issue, can you reformat linode_api4-python/test/integration/models/monitor/test_monitor.py ?

@shkaruna shkaruna force-pushed the feat/clone_and_group_by branch from 1c55c34 to db10d66 Compare June 18, 2026 04:30
@shkaruna

Copy link
Copy Markdown
Contributor Author

To fix the lint issue, can you reformat linode_api4-python/test/integration/models/monitor/test_monitor.py ?

Fixed the lint issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution for contributions made by a non-DX author new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants