Skip to content

WS3: percent-autogrowth-on-large-files config recommendation#1066

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/recs-ws3-autogrowth
Jun 5, 2026
Merged

WS3: percent-autogrowth-on-large-files config recommendation#1066
erikdarlingdata merged 1 commit into
devfrom
feature/recs-ws3-autogrowth

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Scope

First WS3 catalog fact for the recommendations-engine rebuild: a percent-autogrowth-on-large-files config recommendation. Flags data/log files that are large (total_size_mb >= 10240, i.e. 10 GB) AND on PERCENTAGE autogrowth (is_percent_growth = 1) — a % growth on a big file is a single huge allocation that stalls writes — and recommends switching to a size-tiered fixed-MB FILEGROWTH. System DBs (master/msdb/model/tempdb) excluded; both data and log files included (labelled by file_type_desc).

Advise + copy-paste ONLY this PR — no Apply. No handler is registered for the FILE_AUTOGROWTH_PERCENT fact key, so HasHandlerFor returns false → no Apply button, no destructive-consent path. The fact mirrors the existing DB_CONFIG config-advisory pattern end to end.

Size tiers for the suggested fixed FILEGROWTH: 256 MB (10–50 GB), 512 MB (50–200 GB), 1024 MB (> 200 GB) — a starting point the advice tells the operator to tune.

File:line changelog

Shared analysis (PerformanceMonitor.Analysis)

  • RemediationAction.cs:36FileGrowthTargets trailing optional ctor param; :147 new FileGrowthTarget record (advisory-only carrier).
  • FactScorer.cs:36"config" dispatch arm; :246 ScoreConfigFact (base 0.3 for FILE_AUTOGROWTH_PERCENT when file_count > 0, 0 otherwise; every other config-source fact still scores 0).
  • InferenceEngine.cs:40FILE_AUTOGROWTH_PERCENT added to ConfigAdvisoryRootKeys (roots standalone at 0.3).
  • FactAdvice.cs:428 — authored t["FILE_AUTOGROWTH_PERCENT"] AdviceBlock (Headline "Large file(s) growing in percentage steps").
  • FactRemediation.cs:42 GenerateForFinding arm; :107 BuildFileAutogrowthAction; :617 ExtractFileGrowthTargets; :668 GenerateForFileAutogrowth; :686 RecommendedGrowthMbFor (tier); :700 BuildModifyFileStatement (shared QUOTENAME renderer).

Notifications (PerformanceMonitor.Notifications)

  • AlertContext.cs:86 RemediationActionDto.FileGrowthTargets; :150 FileGrowthTargetDto; ToDto/FromDto branches so the advisory action round-trips through remediation_action_json.

Dashboard

  • Analysis/SqlServerFactCollector.cs:50 pipeline wire; :1551 CollectFileAutogrowthFactsAsync (reads collect.database_size_stats, parameterized @minSizeMb).
  • Analysis/SqlServerDrillDownCollector.cs:58 pre-0.5-gate dispatch; :806 CollectAutogrowthPercentFiles (emits autogrowth_percent_files with per-file detail + alter_statement via the shared renderer, TOP (50)).
  • Analysis/AnalysisService.cs:171 ?? BuildFileAutogrowthAction(finding) in the action-build chain.
  • Services/Recommendations/RecommendationsReader.cs:250 BuildCopyPasteFromAction renders MODIFY FILE from FileGrowthTargets (SettingFromAction already returns None → never de-dupes).
  • Mcp/McpAnalysisTools.cs:456 next-tool map entry.

Lite (advise/copy-paste only; drill-down is the fix surface — no action persisted)

  • Analysis/DuckDbFactCollector.cs:50 pipeline wire; :1446 CollectFileAutogrowthFactsAsync (reads database_size_stats, $1 server filter).
  • Analysis/DrillDownCollector.cs:56 pre-0.5-gate dispatch; :846 CollectAutogrowthPercentFiles (reads v_database_size_stats).
  • Analysis/TestDataSeeder.cs:1819 SeedPercentAutogrowthFilesAsync (test helper).
  • Mcp/McpAnalysisTools.cs:792 next-tool map entry.

Tests

  • Dashboard.Tests/FactScorerTests.cs — scorer 0.3-when-files / 0-when-none, advice-block-exists.
  • Dashboard.Tests/InferenceEngineTests.csFileAutogrowthPercentFact_RootsStandalone_BelowMinimumSeverity.
  • Dashboard.Tests/RecommendationDeduperTests.csBuildCopyPasteFromAction MODIFY FILE rendering + MapEngineFinding carries copy-paste / Setting == None.
  • Dashboard.Tests/AnalysisNotificationTests.cs — build-from-drill-down + SerializeAction/DeserializeAction round-trip.
  • Lite.Tests/FactCollectorTests.cs — collector emission smoke tests (qualifying-only; absent-when-none) against the real DuckDB schema.

Test counts (real, --no-build)

  • Dashboard.Tests: 324 passed, 0 failed, 0 skipped.
  • Lite.Tests: 362 passed, 0 failed, 0 skipped. (the order-dependent AzureAuthConnectionStringTests.UpdateServer_ServicePrincipalToEntraMfa_BlankUsername_DeletesOrphanedSecret passed in-suite this run.)
  • dotnet build PerformanceMonitor.sln -c Debug: 0 warnings, 0 errors.

Needs integration verification (live server, e.g. sql2022)

The SQL collection + drill-down need a server with a real large percent-growth file; not exercised by the unit suite:

  1. CollectFileAutogrowthFactsAsync actually emits the FILE_AUTOGROWTH_PERCENT fact on a server whose collect.database_size_stats has a >= 10 GB file with is_percent_growth = 1 in a user DB.
  2. The finding surfaces (roots at 0.3) and the autogrowth_percent_files drill-down lists the file(s) with a valid copy-paste ALTER DATABASE ... MODIFY FILE statement.
  3. The persisted advisory action round-trips through config.analysis_findings.remediation_action_json and the Recommendations reader's CopyPasteSql carries the MODIFY FILE text on read.
  4. No Apply affordance appears for the finding (advisory only).

🤖 Generated with Claude Code

First WS3 catalog fact for the recommendations-engine rebuild. Flags large
(>= 10 GB) data/log files set to PERCENTAGE autogrowth — a % growth on a big
file is a single huge, stalling allocation — and recommends switching to a
size-tiered fixed-MB FILEGROWTH. Advise + copy-paste only this PR (no Apply:
no handler is registered for the FILE_AUTOGROWTH_PERCENT fact key).

Mirrors the existing DB_CONFIG config-advisory pattern end to end:
- Collectors: new FILE_AUTOGROWTH_PERCENT fact (Source "config") from
  collect.database_size_stats (Dashboard) / database_size_stats (Lite),
  latest row per file, system DBs excluded; metadata carries file/db counts.
- Scoring: new "config"-source scorer arm scores it base 0.3 (advisory),
  below the 0.5 incident threshold; all other config-source leaf/amplifier
  facts keep scoring 0 exactly as before.
- Advice: authored AdviceBlock (Headline/Investigation/Remediation).
- Drill-down: lists offending files with a per-file copy-paste
  ALTER DATABASE ... MODIFY FILE built from a SHARED renderer (collector and
  reader render byte-identical statements); collected below the 0.5 gate.
- Rooting: added FILE_AUTOGROWTH_PERCENT to ConfigAdvisoryRootKeys so it roots
  standalone at 0.3.
- Reader: copy-paste flows through MapEngineFinding via a persisted advisory
  RemediationAction carrying typed FileGrowthTargets (the drill-down is
  ephemeral / not read back) — round-trips through AlertContextSerializer.
- MCP next-tool maps updated for parity (both apps).

Tests: scorer (0.3 when files present, 0 when none), advice-block-exists,
standalone rooting at 0.3, reader copy-paste + MapEngineFinding, serialize/
deserialize round-trip, and Lite collector emission smoke tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit b42ff25 into dev Jun 5, 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