Azure / Azure/data-api-builder
[Bug]: Critical! No database query trace spans
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
SQL queries are logged at debug level (visible in OTEL logs and file telemetry) but are never emitted as trace spans. There is no way to see database latency in a trace waterfall or correlate slow queries back to the HTTP request that triggered them.
## Expected
Each SQL query should produce a child span under the parent HTTP request span, following the [OTEL database semantic conventions](https://opentelemetry.io/docs/specs/semconv/database/):
```
[Server] GET /api/Todo ── 220ms
└─ [Client] SELECT ... FROM dbo.Todo ── 18ms
db.system = mssql
db.name = TodoDb
db.statement = SELECT TOP 101 [dbo_Todo].[id] ...
```
This is standard for .NET apps using `AddSqlClientInstrumentation()`.
## Actual
SQL queries only appear in debug-level OTEL logs, not as trace spans:
```
InstrumentationScope Azure.DataApiBuilder.Core.Resolvers.IQueryExecutor
LogRecord #1
Body: Str( Executing query: SELECT TOP 101 [dbo_Todo].[id] AS [id], ...)
```
Zero `db.system: mssql` spans exist. The `TracerProvider` does not register `AddSqlClientInstrumentation()`.
Contributor guide
Assessment
This issue has not been assessed yet.