Skip to content

Align cost report codebundles#624

Merged
stewartshea merged 6 commits intorunwhen-contrib:mainfrom
stewartshea:updates/022426-01
Feb 26, 2026
Merged

Align cost report codebundles#624
stewartshea merged 6 commits intorunwhen-contrib:mainfrom
stewartshea:updates/022426-01

Conversation

@stewartshea
Copy link
Contributor

@stewartshea stewartshea commented Feb 25, 2026

  • Added new variables for output format, cost budget, and cost concentration threshold in the AWS cost report script.
  • Implemented daily cost querying for the last 7 days to improve cost trend analysis.
  • Enhanced the cost report generation to include high-cost contributors and services under $1.
  • Updated runbook templates to incorporate new variables for better configurability and clarity.
  • Removed obsolete SLI scripts to streamline the codebase.

Note

Medium Risk
Adds new scheduled execution paths and expands cost/version analysis logic that affects alert/issue generation across AWS/Azure/GCP; failures or threshold mistakes could cause missed or noisy cost/health signals.

Overview
SLI execution model is reworked to use a shared cron scheduler wrapper. Multiple SLI templates (AWS account cost health, EKS health, AKS triage, GKE cluster health) now point to rw-workspace-utils codebundles/cron-scheduler-sli/sli.robot, switch display units to Execution Status, introduce CRON_SCHEDULE/TARGET_SLX/DRY_RUN config, drop embedded auth secrets, and remove the per-bundle sli.robot implementations.

Cost reporting is expanded with daily/anomaly/budget/concentration analysis. aws_cost_report.sh adds daily spend (last 7 days), anomaly detection, budget and cost-concentration checks, optional CSV/JSON exports, and a shared add_issue accumulator; the AWS cost runbook exposes new variables (OUTPUT_FORMAT, COST_BUDGET, COST_CONCENTRATION_THRESHOLD). azure_cost_historical_report.sh similarly adds daily spend/anomaly reporting plus budget and concentration issue generation, and refactors report generation to use temp files to avoid ARG_MAX limits; its runbook wires the new budget/concentration variables.

Kubernetes version support checks are added for managed clusters. New scripts/runbook tasks validate version support and quantify extended-support cost impact for EKS, AKS, and GKE, emitting structured issue JSON that the runbooks translate into platform issues.

.gitignore now ignores **/debug/**.

Written by Cursor Bugbot for commit 80e02de. This will update automatically on new commits. Configure here.

…features

- Added new variables for output format, cost budget, and cost concentration threshold in the AWS cost report script.
- Implemented daily cost querying for the last 7 days to improve cost trend analysis.
- Enhanced the cost report generation to include high-cost contributors and services under $1.
- Updated runbook templates to incorporate new variables for better configurability and clarity.
- Removed obsolete SLI scripts to streamline the codebase.
@stewartshea stewartshea requested a review from a team as a code owner February 25, 2026 12:41
@stewartshea stewartshea changed the title Update AWS cost report script and templates to enhance cost analysis features Align cost report codebundles Feb 25, 2026
- Updated logging messages to include relevant emojis for better visual cues.
- Enhanced report formatting with improved table structures and clearer section headers.
- Added detailed breakdowns for cost analysis, including daily spend and anomaly detection.
- Improved overall readability and user experience in the generated cost reports.
…agement

- Updated AWS cost report script to enhance sorting logic for cost changes.
- Improved Azure cost historical report script to parse API responses more robustly, accommodating varying column orders.
- Refactored GKE version support check script to use location parameter instead of zone for better compatibility.
- Enhanced runbook to include detailed issue reporting for GKE version checks, improving clarity on potential failures.
… threshold

- Modified AWS cost report script to use a variable for the cost concentration threshold, enhancing flexibility in high-cost contributor reporting.
- Updated Azure cost historical report script to ensure cost values are parsed as numbers, improving data accuracy in reports.
@stewartshea
Copy link
Contributor Author

bugbot review

- Updated AWS cost report script to correct sorting logic for cost changes by using absolute values.
- Enhanced Azure AKS cost optimization script to filter VMSS list based on node pool name more effectively.
- Modified Azure cost historical report script to utilize a configurable cost concentration threshold for identifying high-cost contributors.
- Improved anomaly detection logic to avoid false positives when daily averages are zero.
- Added cleanup logic in GKE version support check script to ensure temporary files are removed after execution.
…ng in cost report

- Updated AKS version check script to handle missing JSON file gracefully by providing an empty issues array.
- Improved date formatting in Azure cost historical report script to convert date strings from 'YYYYMMDD' to 'YYYY-MM-DD' format, enhancing readability and consistency in reports.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

if [[ -n "$node_resource_group" ]]; then
progress " Finding VMSS for node pool: $node_pool_name..."
local vmss_list=$(az vmss list --resource-group "$node_resource_group" --subscription "$subscription_id" \
-o json 2>/dev/null | jq --arg pool "$node_pool_name" '[.[] | select(.name | contains($pool)) | {name: .name, id: .id}]' 2>/dev/null || echo '[]')
Copy link

Choose a reason for hiding this comment

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

VMSS substring matching can select wrong node pool

Medium Severity

The VMSS discovery uses jq's contains($pool) for substring matching, which can match the wrong VMSS when node pool names are prefixes of each other. For example, a pool named pool1 would match both aks-pool1-xxxxx-vmss and aks-pool10-xxxxx-vmss. Since .[0] picks the first match, the wrong VMSS metrics may be returned, leading to inaccurate utilization data and incorrect cost optimization recommendations.

Additional Locations (1)

Fix in Cursor Fix in Web

@stewartshea stewartshea merged commit 4fbeb89 into runwhen-contrib:main Feb 26, 2026
2 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.

1 participant