mirror of
https://github.com/zoriya/drizzle-otel.git
synced 2026-06-08 21:04:43 +00:00
update README
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
OpenTelemetry instrumentation for [Drizzle ORM](https://orm.drizzle.team/). Add distributed tracing to your database queries with a single line of code.
|
||||
|
||||

|
||||
|
||||
*Visualize your database queries with detailed span information including operation type, SQL statements, and performance metrics.*
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
@@ -59,15 +63,26 @@ const db = instrumentDrizzle(drizzle(sqlite), { dbSystem: "sqlite" });
|
||||
|
||||
## What You Get
|
||||
|
||||
Each database query automatically creates a span with:
|
||||
Each database query automatically creates a span with rich telemetry data:
|
||||
|
||||
- **Span name**: `drizzle.select`, `drizzle.insert`, `drizzle.update`, etc.
|
||||
- **SQL operation**: Extracted from query (SELECT, INSERT, UPDATE, DELETE)
|
||||
- **Full SQL query**: Captured and sanitized (configurable)
|
||||
- **Error tracking**: Exceptions are recorded with stack traces
|
||||
- **Database metadata**: System, name, host, and port information
|
||||
- **Operation type**: `db.operation` attribute (SELECT, INSERT, UPDATE, DELETE)
|
||||
- **SQL query text**: Full query statement captured in `db.statement` (configurable)
|
||||
- **Database system**: `db.system` attribute (postgresql, mysql, sqlite, etc.)
|
||||
- **Error tracking**: Exceptions are recorded with stack traces and proper span status
|
||||
- **Performance metrics**: Duration and timing information for every query
|
||||
|
||||
Follows [OpenTelemetry semantic conventions](https://opentelemetry.io/docs/specs/semconv/database/) for database instrumentation.
|
||||
### Span Attributes
|
||||
|
||||
The instrumentation adds the following attributes to each span following [OpenTelemetry semantic conventions](https://opentelemetry.io/docs/specs/semconv/database/):
|
||||
|
||||
| Attribute | Description | Example |
|
||||
|-----------|-------------|---------|
|
||||
| `db.operation` | SQL operation type | `SELECT` |
|
||||
| `db.statement` | Full SQL query | `select "id", "name" from "users"...` |
|
||||
| `db.system` | Database system | `postgresql` |
|
||||
| `db.name` | Database name | `myapp` |
|
||||
| `operation.name` | Client operation name | `kubiks_otel-drizzle.client` |
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user