otel_drift 0.2.0
otel_drift: ^0.2.0 copied to clipboard
OpenTelemetry instrumentation for package:drift. A drift QueryInterceptor emitting db.system.name=sqlite CLIENT spans per statement, plus traced call-site helpers.
Changelog #
0.2.0 - 2026-08-09 #
Changed #
- Semantic conventions updated to the current OTel registry: deprecated
attribute keys are no longer emitted (
db.system->db.system.name,db.operation->db.operation.name). The non-registrydb.driftmarker attribute was dropped; the instrumentation scope name (otel_drift) already identifies the source. - Dependency floors raised to
dartastic_opentelemetry ^1.1.0-beta.12anddartastic_opentelemetry_api ^1.0.0-rc.1. The previous floors declared compatibility with API versions that predate the semconv enums this package uses and could not actually resolve-and-compile. driftfloor raised to^2.14.0, the release that introduced theQueryInterceptorAPI.repositoryURL corrected to the canonicalDartasticorg casing so pub.dev repository verification succeeds.
Added #
OTelDriftInterceptor— a driftQueryInterceptorthat opens a CLIENT span around every statement drift executes (select / insert / update / delete / custom / batch, plus transaction commit and rollback), withdb.system.name=sqlite,db.operation.name,db.operation.batch.sizeon batches, and opt-indb.query.text(captureQueryText: true; off by default because statements can embed sensitive literals). Apply withexecutor.interceptWith(OTelDriftInterceptor()).tracedDriftQuery<R>({operation, table, sql, invoke})— call-site helper that opens a CLIENT span labelled with the intent (operation + table,db.collection.name) around a DAO call.tracedDriftTransaction<R>(body)— convenience fortracedDriftQuery(operation: 'transaction', invoke: body).- Zone-scoped suppression
(
runWithoutDriftInstrumentation/ async variant), honored by both the interceptor and the helpers. - Tests: interceptor asserted through drift's real
interceptWithwiring against a fakeQueryExecutor(delegation, attributes, batch size, commit, error status, suppression) plus the helper suite. Anexample/was added.