Azure / Azure/data-api-builder
[Bug]: Critical! Health check response-ms includes full HTTP roundtrip, not just query time
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
The `response-ms` value in health check results measures the full self-HTTP-call duration (HTTP client → middleware → auth → routing → controller → DB → response), not just the database query execution time.
## Expected
`response-ms` should ideally represent the actual database query or endpoint processing time, making it useful for monitoring database health.
## Actual
The health check implementation (`HealthCheckHelper`) makes real HTTP calls to `GET /api/{entity}?$first=N` and `POST /graphql`. The `response-ms` measures the complete round-trip through:
1. HTTP client overhead
2. Kestrel request processing
3. Authentication middleware
4. Routing middleware
5. Controller action
6. SQL query execution
7. JSON serialization
8. Response delivery
Evidence from DAB logs:
```
Start processing HTTP request GET http://localhost:5000/api/Todo?$first=50
Sending HTTP request GET http://localhost:5000/api/Todo?$first=50
...
Received HTTP response headers after 155.4462ms - 200
```
A simple `SELECT TOP 51` query takes <5ms in the database, but the health check reports 155ms+ because it includes the full middleware pipeline. On cold starts (first health check after startup), this can be 500-700ms+.
Contributor guide
Assessment
This issue has not been assessed yet.