Commit 8d62beb
Fix: Exclude stored procedures from health checks (#2997)
## Why make this change?
Closes #2977
Health check endpoint was returning results for stored procedures.
Stored procedures should be excluded because:
1. They require parameters not configurable via health settings
2. They are not deterministic, making health checks unreliable
## What is this change?
Added filter in
`HealthCheckHelper.UpdateEntityHealthCheckResultsAsync()` to exclude
entities with `EntitySourceType.StoredProcedure`:
```csharp
// Before
.Where(e => e.Value.IsEntityHealthEnabled)
// After
.Where(e => e.Value.IsEntityHealthEnabled && e.Value.Source.Type != EntitySourceType.StoredProcedure)
```
Only tables and views are now included in entity health checks.
## How was this tested?
- [ ] Integration Tests
- [x] Unit Tests
Added `HealthChecks_ExcludeStoredProcedures()` unit test that creates a
`RuntimeConfig` with both table and stored procedure entities, then
applies the same filter used in
`HealthCheckHelper.UpdateEntityHealthCheckResultsAsync` to verify stored
procedures are excluded while tables are included.
## Sample Request(s)
Health check response after fix (stored procedure `GetSeriesActors` no
longer appears):
```json
{
"status": "Healthy",
"checks": [
{
"name": "MSSQL",
"tags": ["data-source"]
},
{
"name": "Book",
"tags": ["rest", "endpoint"]
}
]
}
```
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>[Bug]: Health erroneously checks Stored
Procedures</issue_title>
> <issue_description>## What?
>
> Health check returns check results for stored procs. It should ONLY
include tables and views.
>
> ## Health output sample
>
> ```json
> {
> "status": "Healthy",
> "version": "1.7.81",
> "app-name": "dab_oss_1.7.81",
> "timestamp": "2025-11-17T20:33:42.2752261Z",
> "configuration": {
> "rest": true,
> "graphql": true,
> "mcp": true,
> "caching": true,
> "telemetry": false,
> "mode": "Development"
> },
> "checks": [
> {
> "status": "Healthy",
> "name": "MSSQL",
> "tags": [
> "data-source"
> ],
> "data": {
> "response-ms": 3,
> "threshold-ms": 1000
> }
> },
> {
> "status": "Healthy",
> "name": "GetSeriesActors", // stored procedure
> "tags": [
> "graphql",
> "endpoint"
> ],
> "data": {
> "response-ms": 1,
> "threshold-ms": 1000
> }
> },
> {
> "status": "Healthy",
> "name": "GetSeriesActors", // stored procedure
> "tags": [
> "rest",
> "endpoint"
> ],
> "data": {
> "response-ms": 5,
> "threshold-ms": 1000
> }
> }
> ]
> }
> ```</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> <comment_new><author>@souvikghosh04</author><body>
> @JerryNixon / @Aniruddh25 should stored procedures and functions be
discarded from health checks permanently?</body></comment_new>
> <comment_new><author>@JerryNixon</author><body>
> The entity checks in the Health endpoint check every table and view
type entity with a user-configurable select with a first compared
against a user-configurable threshold. We do not check stored
procedures, and cannot check stored procedures, as we do not have any
mechanism to take parameters as Health configuration values. Also stored
procedures are not guaranteed to be deterministic, making checks that
would call them potentially be unreliable. So, yes, stored procedures
should be ignored. </body></comment_new>
> </comments>
>
</details>
- Fixes #2982
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Aniruddh25 <[email protected]>
Co-authored-by: JerryNixon <[email protected]>1 parent eddd4c6 commit 8d62beb
2 files changed
Lines changed: 90 additions & 1 deletion
File tree
- src
- Service.Tests/Configuration
- Service/HealthCheck
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
567 | 655 | | |
568 | 656 | | |
569 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
205 | | - | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
| |||
0 commit comments