Updating Go sdk to include group_by at dashboard level#979
Merged
yec-akamai merged 2 commits intoJun 2, 2026
Conversation
shkaruna
approved these changes
Jun 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates monitor dashboard models and test fixtures to represent group_by at the dashboard level (instead of per-widget), and adjusts unit/integration tests accordingly.
Changes:
- Added
group_byto theMonitorDashboardmodel. - Updated unit test assertions to validate dashboard-level
group_by. - Refreshed unit/integration fixtures to move
group_byto dashboard level and adjust widget fields.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| monitor_dashboards.go | Adds GroupBy field to MonitorDashboard JSON model. |
| test/unit/monitor_dashboards_test.go | Updates assertions to check dashboard-level group_by. |
| test/unit/fixtures/monitor_dashboards.json | Moves group_by to dashboard and removes it from widgets; adjusts widget fields. |
| test/unit/fixtures/monitor_dashboard_by_service_type.json | Same fixture updates for service-type endpoint. |
| test/unit/fixtures/monitor_dashboard_by_id.json | Same fixture updates for by-id endpoint. |
| test/integration/monitor_dashboards_test.go | Loosens group_by validation to allow optional presence. |
| test/integration/fixtures/TestMonitorDashboards_Get.yaml | Updates recorded responses: dashboard-level group_by, updated labels, and header changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if widget.GroupBy != nil { | ||
| require.NotEmpty(t, widget.GroupBy, "group_by should not be empty when present") | ||
| } | ||
| require.GreaterOrEqual(t, len(widget.GroupBy), 0, "group_by should be a slice (possibly empty)") |
Comment on lines
+30
to
+31
| assert.NotEmpty(t, clients[0].GroupBy, "Expected group_by to be present at dashboard level") | ||
| assert.Equal(t, []string{"entity_id"}, clients[0].GroupBy, "Expected dashboard group_by to match") |
Comment on lines
77
to
+80
| "size": 6, | ||
| "chart_type": "area", | ||
| "y_label": "write_iops", | ||
| "aggregate_function": "sum", | ||
| "group_by": ["entity_id"], | ||
| "filters": [ | ||
| { | ||
| "dimension_label": "pattern", | ||
| "operator": "in", | ||
| "value": "publicout,privateout" | ||
| } | ||
| ] | ||
| "aggregate_function": "avg" |
Contributor
There was a problem hiding this comment.
^looks like group_by is not returned at widgets level anymore. Can you mark it as deprecated in the DashboardWidget?
Comment on lines
294
to
+297
| - DENY | ||
| - DENY | ||
| X-Oauth-Scopes: | ||
| - account:read_only databases:read_only domains:read_only events:read_only firewall:read_only | ||
| images:read_only ips:read_only linodes:read_only lke:read_only longview:read_only | ||
| monitor:read_only nodebalancers:read_only object_storage:read_only stackscripts:read_only | ||
| volumes:read_only | ||
| - '*' |
mawilk90
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updating Go sdk to include group_by at dashboard level
✔️ 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 "..MonitorDashboard.." -v
Expected Output:
✅ TestListMonitorDashboards
✅ TestListMonitorDashboardsByID
✅ TestListMonitorDashboardsByServiceType
INTEGRATION TEST:
export LINODE_TOKEN="your-linode-api-token"
go test ./test/integration -run "TestMonitorDashboards_Get_smoke" -v
Test Coverage:
List Monitor Dashboards: Verifies listing all monitor dashboards returns correct data and structure.
List Monitor Dashboards By ID: Verifies fetching a single monitor dashboard by ID returns the expected dashboard.
List Monitor Dashboards By Service: Verifies listing dashboards filtered by service type returns the correct dashboards.
📷 Preview
If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.