DB facade or Eloquent. Each query produces a dedicated CLIENT span, enabling you to identify slow queries and understand database usage patterns.
Spans are only created when a trace is already active (i.e. within a traced request, job, or command). Standalone queries executed outside any active trace are ignored.
Span Details
- Span name: The SQL operation name —
SELECT,INSERT,UPDATE, orDELETE. - Span kind:
CLIENT - Attributes captured: database system, database name, operation name, query text (truncated to 500 characters), server address, and server port.
Only queries with recognised operation keywords (
SELECT, INSERT, UPDATE, DELETE) are traced. Raw statements with other leading keywords are skipped.Configuration
Inconfig/opentelemetry.php:
Metrics
| Metric | Type | Unit | Description |
|---|---|---|---|
db.client.operation.duration | Histogram | seconds | Duration of database client operations. |
0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0, 5.0, 10.0.
Disabling
Set the environment variable tofalse to disable this instrumentation:
QueryInstrumentation::class from the instrumentation array in config/opentelemetry.php.