Azure / Azure/data-api-builder

[Bug]: Critical! Health check response-ms includes full HTTP roundtrip, not just query time

Aperta
#3,568 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
2.x health-endpoint
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 17h
PR unite (30g)
8

Descrizione

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+.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia individuando HealthCheckHelper e tracciando il modo in cui misura i tempi delle chiamate GET /api/{entity}?$first=N e POST /graphql. Confronta il valore response-ms riportato con il tempo di elaborazione del database o dell’endpoint; il lavoro è completato quando la metrica esclude l’intero roundtrip HTTP e middleware ed è coperta da test appropriati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, graphql, sql
Ambito
api, databases, observability
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.