runbooks 0.9.1__py3-none-any.whl → 0.9.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. runbooks/__init__.py +15 -6
  2. runbooks/cfat/__init__.py +3 -1
  3. runbooks/cloudops/__init__.py +3 -1
  4. runbooks/common/aws_utils.py +367 -0
  5. runbooks/common/enhanced_logging_example.py +239 -0
  6. runbooks/common/enhanced_logging_integration_example.py +257 -0
  7. runbooks/common/logging_integration_helper.py +344 -0
  8. runbooks/common/profile_utils.py +8 -6
  9. runbooks/common/rich_utils.py +347 -3
  10. runbooks/enterprise/logging.py +400 -38
  11. runbooks/finops/README.md +262 -406
  12. runbooks/finops/__init__.py +2 -1
  13. runbooks/finops/accuracy_cross_validator.py +12 -3
  14. runbooks/finops/commvault_ec2_analysis.py +415 -0
  15. runbooks/finops/cost_processor.py +718 -42
  16. runbooks/finops/dashboard_router.py +44 -22
  17. runbooks/finops/dashboard_runner.py +302 -39
  18. runbooks/finops/embedded_mcp_validator.py +358 -48
  19. runbooks/finops/finops_scenarios.py +771 -0
  20. runbooks/finops/multi_dashboard.py +30 -15
  21. runbooks/finops/single_dashboard.py +386 -58
  22. runbooks/finops/types.py +29 -4
  23. runbooks/inventory/__init__.py +2 -1
  24. runbooks/main.py +522 -29
  25. runbooks/operate/__init__.py +3 -1
  26. runbooks/remediation/__init__.py +3 -1
  27. runbooks/remediation/commons.py +55 -16
  28. runbooks/remediation/commvault_ec2_analysis.py +259 -0
  29. runbooks/remediation/rds_snapshot_list.py +267 -102
  30. runbooks/remediation/workspaces_list.py +182 -31
  31. runbooks/security/__init__.py +3 -1
  32. runbooks/sre/__init__.py +2 -1
  33. runbooks/utils/__init__.py +81 -6
  34. runbooks/utils/version_validator.py +241 -0
  35. runbooks/vpc/__init__.py +2 -1
  36. runbooks-0.9.4.dist-info/METADATA +563 -0
  37. {runbooks-0.9.1.dist-info → runbooks-0.9.4.dist-info}/RECORD +41 -38
  38. {runbooks-0.9.1.dist-info → runbooks-0.9.4.dist-info}/entry_points.txt +1 -0
  39. runbooks/inventory/cloudtrail.md +0 -727
  40. runbooks/inventory/discovery.md +0 -81
  41. runbooks/remediation/CLAUDE.md +0 -100
  42. runbooks/remediation/DOME9.md +0 -218
  43. runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +0 -506
  44. runbooks-0.9.1.dist-info/METADATA +0 -308
  45. {runbooks-0.9.1.dist-info → runbooks-0.9.4.dist-info}/WHEEL +0 -0
  46. {runbooks-0.9.1.dist-info → runbooks-0.9.4.dist-info}/licenses/LICENSE +0 -0
  47. {runbooks-0.9.1.dist-info → runbooks-0.9.4.dist-info}/top_level.txt +0 -0
@@ -68,12 +68,12 @@ from .cost_processor import (
68
68
  get_cost_data,
69
69
  process_service_costs,
70
70
  )
71
- from .dashboard_runner import (
72
- _create_cost_session,
73
- _create_management_session,
74
- _create_operational_session,
75
- _initialize_profiles,
71
+ from runbooks.common.profile_utils import (
72
+ create_cost_session,
73
+ create_management_session,
74
+ create_operational_session,
76
75
  )
76
+ from .dashboard_runner import _initialize_profiles
77
77
  from .enhanced_progress import track_multi_account_analysis
78
78
  from .helpers import export_cost_dashboard_to_pdf
79
79
  from .service_mapping import get_service_display_name
@@ -564,8 +564,8 @@ class MultiAccountDashboard:
564
564
  display_profile = profile
565
565
 
566
566
  # Initialize sessions using base profile
567
- cost_session = _create_cost_session(base_profile)
568
- mgmt_session = _create_management_session(base_profile)
567
+ cost_session = create_cost_session(base_profile)
568
+ mgmt_session = create_management_session(base_profile)
569
569
 
570
570
  # SRE FIX: Get account ID - use target account for Organizations API or session account
571
571
  if target_account_id:
@@ -1244,15 +1244,24 @@ class MultiAccountDashboard:
1244
1244
 
1245
1245
  top_org_services = sorted(all_services.items(), key=lambda x: x[1], reverse=True)[:5]
1246
1246
 
1247
- # Create summary panel
1248
- overall_trend = ((total_spend - total_last_month) / total_last_month * 100) if total_last_month > 0 else 0
1249
- trend_icon = "⬆" if overall_trend > 0 else "⬇" if overall_trend < 0 else "➡"
1247
+ # Create summary panel with enhanced trend analysis
1248
+ from .cost_processor import calculate_trend_with_context
1249
+
1250
+ # For multi-account analysis, we generally have full month data, but check for consistency
1251
+ overall_trend_display = calculate_trend_with_context(total_spend, total_last_month)
1252
+
1253
+ # Extract trend direction for icon (maintaining existing functionality)
1254
+ if total_last_month > 0:
1255
+ overall_trend_pct = ((total_spend - total_last_month) / total_last_month * 100)
1256
+ trend_icon = "⬆" if overall_trend_pct > 0 else "⬇" if overall_trend_pct < 0 else "➡"
1257
+ else:
1258
+ trend_icon = "➡"
1250
1259
 
1251
1260
  summary_text = f"""
1252
1261
  [highlight]Organization Summary[/]
1253
1262
  • Total Accounts: {len(accounts)}
1254
1263
  • Total Monthly Spend: {format_cost(total_spend)}
1255
- • Overall Trend: {trend_icon} {abs(overall_trend):.1f}%
1264
+ • Overall Trend: {overall_trend_display}
1256
1265
  • Budget Alerts: {over_budget_count} over budget, {warning_count} warnings
1257
1266
 
1258
1267
  [highlight]Top Organization Services[/]
@@ -1426,9 +1435,15 @@ class MultiAccountDashboard:
1426
1435
  f"| {account_display_escaped} | ${last:.0f} | ${current:.0f} | {services_text_escaped} | {budget_clean_escaped} | {optimization_escaped} |"
1427
1436
  )
1428
1437
 
1429
- # Add summary section
1430
- overall_trend = ((total_current - total_last) / total_last * 100) if total_last > 0 else 0
1431
- trend_direction = "↗️" if overall_trend > 0 else "↘️" if overall_trend < 0 else "➡️"
1438
+ # Add summary section with enhanced trend analysis
1439
+ overall_trend_display = calculate_trend_with_context(total_current, total_last)
1440
+
1441
+ # Extract trend direction for emoji (maintaining existing markdown export format)
1442
+ if total_last > 0:
1443
+ overall_trend_pct = ((total_current - total_last) / total_last * 100)
1444
+ trend_direction = "↗️" if overall_trend_pct > 0 else "↘️" if overall_trend_pct < 0 else "➡️"
1445
+ else:
1446
+ trend_direction = "➡️"
1432
1447
 
1433
1448
  lines.append("")
1434
1449
  lines.append("## Organization Summary")
@@ -1436,7 +1451,7 @@ class MultiAccountDashboard:
1436
1451
  lines.append(f"- **Total Accounts Analyzed**: {len(accounts)}")
1437
1452
  lines.append(f"- **Total Current Month**: ${total_current:,.2f}")
1438
1453
  lines.append(f"- **Total Last Month**: ${total_last:,.2f}")
1439
- lines.append(f"- **Overall Trend**: {trend_direction} {abs(overall_trend):.1f}%")
1454
+ lines.append(f"- **Overall Trend**: {overall_trend_display}")
1440
1455
  lines.append(f"- **Analysis Performance**: {execution_time:.1f}s execution")
1441
1456
  lines.append("")
1442
1457