Skip to content

Add FinOps test infrastructure — scoring extraction and scenario seeding#605

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/finops-test-seeder
Mar 17, 2026
Merged

Add FinOps test infrastructure — scoring extraction and scenario seeding#605
erikdarlingdata merged 1 commit into
devfrom
feature/finops-test-seeder

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

@erikdarlingdata erikdarlingdata commented Mar 17, 2026

Summary

  • Extract High Impact query scoring logic from GetHighImpactQueriesAsync into a testable static HighImpactScorer.Score() method with PercentRank helper
  • Add 6 FinOps test scenarios to TestDataSeeder with reusable seed helpers:
    • Over-provisioned Enterprise server (CPU + memory right-sizing triggers)
    • Idle databases with cost impact (dormant DB detection)
    • High impact query skew (80/20 CPU distribution)
    • Dev/test databases (name-pattern detection — note: live SQL check only)
    • Long-running maintenance jobs (5x ran-long in 7 days)
    • Clean server baseline (no recommendations expected)
  • Add RunFinOpsRecommendationsAsync and RunHighImpactAnalysisAsync test runner methods

Test plan

  • dotnet build Lite/PerformanceMonitorLite.csproj -c Debug — 0 errors
  • Run each scenario via the test harness and verify expected recommendations fire
  • Verify HighImpactScorer.Score() produces correct CPU share for skew scenario (query AAAA > 80%)
  • Verify clean server scenario returns empty/minimal recommendations

Closes #564

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Expanded test infrastructure with FinOps-focused scenarios including over-provisioned enterprise, idle databases, query skew analysis, and long-running job simulations.
  • Refactor

    • Refactored high-impact query analysis to extract and consolidate scoring logic into a dedicated component, improving code maintainability and testability.

…ing (#564)

Extract High Impact scoring into testable HighImpactScorer.Score() static
method. Add 6 FinOps test scenarios to TestDataSeeder:
- Over-provisioned Enterprise server
- Idle databases with cost impact
- High impact query skew (80/20)
- Dev/test databases
- Long-running maintenance jobs
- Clean server (no recommendations)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2d1c03d-46aa-4626-93cf-e7b19536993b

📥 Commits

Reviewing files that changed from the base of the PR and between 87bad78 and ed82dd0.

📒 Files selected for processing (2)
  • Lite/Analysis/TestDataSeeder.cs
  • Lite/Services/LocalDataService.FinOps.cs

📝 Walkthrough

Walkthrough

Extends FinOps analysis capabilities by introducing six public test seed scenarios and two runner methods in TestDataSeeder.cs for orchestrating FinOps recommendations and high-impact analysis tests, alongside five internal helpers. Simultaneously refactors high-impact query scoring logic in LocalDataService.FinOps.cs by extracting it from GetHighImpactQueriesAsync into a new public HighImpactScorer component with consolidated percentile-based scoring utilities.

Changes

Cohort / File(s) Summary
FinOps Test Seed Scenarios
Lite/Analysis/TestDataSeeder.cs
Added six public async methods (SeedOverProvisionedEnterpriseAsync, SeedIdleDatabasesAsync, SeedHighImpactQuerySkewAsync, SeedDevTestDatabasesAsync, SeedLongRunningJobsAsync, SeedCleanFinOpsServerAsync) establishing representative test states for FinOps scenarios, each following clear/seed/populate patterns.
FinOps Test Runners
Lite/Analysis/TestDataSeeder.cs
Added two public async runner methods (RunFinOpsRecommendationsAsync, RunHighImpactAnalysisAsync) to execute recommendation engine and analysis against test data with configurable parameters (cost, time window).
FinOps Test Helpers
Lite/Analysis/TestDataSeeder.cs
Added five internal async helpers (SeedDatabaseSizesForIdleTestAsync, SeedQueryStatsForDatabaseAsync, SeedQueryStatsForHighImpactAsync, SeedDatabaseSizesWithNamesAsync, SeedRunningJobsForMaintenanceTestAsync, SeedDiskSpaceAsync) for populating specific test data categories via DuckDB parameterized commands.
High-Impact Query Scoring Refactor
Lite/Services/LocalDataService.FinOps.cs
Extracted inline scoring logic from GetHighImpactQueriesAsync into new public static class HighImpactScorer with Score method; consolidated PercentRank utility internally; maintains existing HighImpactQueryRow population of share and impact fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/finops-test-seeder
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@erikdarlingdata erikdarlingdata merged commit 5c08471 into dev Mar 17, 2026
3 of 4 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/finops-test-seeder branch April 9, 2026 00:33
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