Skip to content

Conversation

@srbhaakamai
Copy link
Contributor

@srbhaakamai srbhaakamai commented Sep 15, 2025

📝 Description

Provide go SDK support to ACLP clients to perform CRUD operations for Alerts.

✔️ How to Test

How do I run the relevant unit/integration tests?

Prerequisites
Go 1.19+ installed
Valid Linode API token with monitor permissions
Export LINODE_TOKEN environment variable for integration tests

Run all monitor alert definition unit tests:
UNIT TEST:
go test ./test/unit -run ".MonitorAlertDefinition." -v

Expected Output:

✅ TestCreateMonitorAlertDefinition
✅ TestCreateMonitorAlertDefinitionWithIdempotency
✅ TestGetMonitorAlertDefinition
✅ TestListMonitorAlertDefinitions
✅ TestUpdateMonitorAlertDefinition
✅ TestUpdateMonitorAlertDefinition_LabelOnly
✅ TestDeleteMonitorAlertDefinition

INTEGRATION TEST:
export LINODE_TOKEN="your-linode-api-token"
go test ./test/integration -run "TestMonitorAlertDefinition_smoke" -v

Test Coverage:

List Operations: Validates fetching existing alert definitions
Channel Discovery: Finds available alert channels for testing
Create: Tests complex alert definition creation with:
TriggerConditions (evaluation periods, polling intervals)
RuleCriteria with Rules (metrics, operators, thresholds)
DimensionFilters (node type filtering)
Update: Tests label-only updates with proper timing
Delete: Tests cleanup with exponential backoff retry logic
Expected Duration: ~102 seconds (includes API timing requirements)

📷 Preview

If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.

@srbhaakamai srbhaakamai requested a review from a team as a code owner September 15, 2025 13:55
@srbhaakamai srbhaakamai requested review from Copilot, jriddle-linode and yec-akamai and removed request for a team September 15, 2025 13:55
@srbhaakamai srbhaakamai marked this pull request as draft September 15, 2025 13:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces ACLP (Alerting Linode Platform) SDK functionality to the linodego client library, adding support for monitor alert definitions and channels. The implementation includes API client methods, data structures, and comprehensive test coverage.

  • Adds monitor alert definitions CRUD operations with support for v4beta API endpoints
  • Implements monitor channels functionality for alert notification management
  • Provides comprehensive unit and integration test coverage for all new functionality

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
monitor_alert_definitions.go Core implementation of alert definitions API client methods and data structures
monitor_channels.go Monitor channels API client methods and channel management functionality
request_helpers.go New helper function for v4beta API endpoint formatting
test/unit/base.go Enhanced test base to support v4beta endpoint mocking
test/unit/monitor_alert_definitions_test.go Comprehensive unit tests for alert definitions functionality
test/integration/monitor_alert_definitions_test.go Integration test with real API interaction scenarios
test/integration/fixtures/TestMonitorAlertDefinition_instance.yaml Test fixture data for integration testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@srbhaakamai srbhaakamai closed this Oct 4, 2025
@srbhaakamai srbhaakamai reopened this Oct 4, 2025
@srbhaakamai srbhaakamai force-pushed the main branch 3 times, most recently from 9226cfb to 8e71881 Compare October 4, 2025 04:43
@srbhaakamai srbhaakamai marked this pull request as ready for review October 13, 2025 11:04
@lgarber-akamai lgarber-akamai self-requested a review October 31, 2025 16:51
@yec-akamai yec-akamai requested a review from Copilot November 4, 2025 19:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 77 out of 81 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

It seems some unrelated commits are added accidentally. Do you mind cleaning up the branch and fixing the conflicts?

@lgarber-akamai
Copy link
Contributor

@srbhaakamai Just bumping Ye's comment — could you resolve the conflicts and unrelated comments on this branch? I'm happy to do it too and push up the new commit if you'd like

@lgarber-akamai lgarber-akamai force-pushed the main branch 2 times, most recently from 7818a6b to aed99f8 Compare November 13, 2025 16:02
@lgarber-akamai
Copy link
Contributor

@srbhaakamai I just finished up fixing up the commit history and will be providing a review shortly 👍

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@srbhaakamai
Copy link
Contributor Author

@yec-akamai thanks for the valuable review comments. i fixed all of them and kept 2 as i dont understand them, please check and let me know if my answers address your concerns.

All other comments are addressed committed tested locally and pushed to branch for review.

@srbhaakamai
Copy link
Contributor Author

@yec-akamai i am not clear on merge conflict , i mean which one to chose so , please help me or resolve that.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@linode linode deleted a comment from Copilot AI Dec 16, 2025
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Can you also update the integration test fixtures given the structs have changed?

srbhaakamai and others added 3 commits December 18, 2025 11:44
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Thanks for addressing previous comments. Can you fix the integration test failures and lint issues?

@srbhaakamai
Copy link
Contributor Author

@yec-akamai csn we trigger CI test and see if it passes now, i ran locally and its working fine.

@yec-akamai yec-akamai merged commit 3c29b43 into linode:main Dec 22, 2025
10 checks passed
Comment on lines +134 to +135
RuleCriteria RuleCriteriaOptions `json:"rule_criteria"` // optional
TriggerConditions TriggerConditions `json:"trigger_conditions"` // optional
Copy link
Member

Choose a reason for hiding this comment

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

omitempty should apply to all option fields, and optional fields should be pointers with an exception of nil-able slice

Comment on lines +123 to +126
RuleCriteria RuleCriteriaOptions `json:"rule_criteria"` // optional
TriggerConditions TriggerConditions `json:"trigger_conditions"` // optional
EntityIDs []string `json:"entity_ids,omitempty"` // optional
Description string `json:"description,omitempty"` // optional
Copy link
Member

Choose a reason for hiding this comment

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

Same problems here

// ListMonitorAlertDefinitions returns a paginated list of ACLP Monitor Alert Definitions by service type.
func (c *Client) ListMonitorAlertDefinitions(
ctx context.Context,
serviceType string,
Copy link
Member

@zliang-akamai zliang-akamai Dec 22, 2025

Choose a reason for hiding this comment

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

Should serviceType be ServiceType Enum type?

Comment on lines +298 to +301
// Cleanup
if createdAlert != nil {
_ = client.DeleteMonitorAlertDefinition(context.Background(), testMonitorAlertDefinitionServiceType, createdAlert.ID)
}
Copy link
Member

@zliang-akamai zliang-akamai Dec 22, 2025

Choose a reason for hiding this comment

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

Cleanup logic should be wrapped in a function and called via defer key word to ensure it's always executed even if a hard failure (fatal) is in the test case.

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.

5 participants