Skip to content

Fix query_cost overflow and add Last Error At column#47

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/fix-query-cost-overflow
Feb 15, 2026
Merged

Fix query_cost overflow and add Last Error At column#47
erikdarlingdata merged 1 commit intodevfrom
feature/fix-query-cost-overflow

Conversation

@erikdarlingdata
Copy link
Owner

Summary

Two small fixes from testing the new Collection Health tab:

  1. SafeToDecimal() for query_costsys.dm_exec_query_memory_grants.query_cost is a SQL Server float that can be Infinity or NaN for degenerate query plans. Convert.ToDecimal() can't represent these and throws "Value was either too large or too small for an Int64". New SafeToDecimal() helper handles this gracefully.

  2. Last Error At column — The Health Summary grid showed what the last error was but not when it happened. Added last_error_time to the query and a "Last Error At" column so you can tell if an error is current or ancient history.

Test plan

  • dotnet build -c Debug — builds clean
  • Launch Lite, check Collection Health → Health Summary — "Last Error At" column shows timestamp for collectors that have errored
  • Memory grant collector no longer errors on queries with extreme cost values

🤖 Generated with Claude Code

…column

- SafeToDecimal() guards against Infinity/NaN from SQL Server float columns
  that crash Convert.ToDecimal() (e.g. query_cost in dm_exec_query_memory_grants)
- Add Last Error At timestamp column to Health Summary grid so users can tell
  when an error occurred, not just what it was
- Add last_error_time to GetCollectionHealthAsync() query

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit c957c0d into dev Feb 15, 2026
1 check passed
@erikdarlingdata erikdarlingdata mentioned this pull request Feb 18, 2026
3 tasks
@erikdarlingdata erikdarlingdata deleted the feature/fix-query-cost-overflow branch February 20, 2026 13:20
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