otel_postgres 0.2.0
otel_postgres: ^0.2.0 copied to clipboard
OpenTelemetry instrumentation for package:postgres. Wraps query execution in CLIENT-kind spans following the OTel database semantic conventions (db.system.name=postgresql).
Changelog #
0.2.0 - 2026-08-10 #
Changed #
- Docs and tests now reference the current stable DB semconv keys
(
db.system.name,db.operation.name) instead of the deprecateddb.system/db.operationforms the library had already stopped emitting.
Added #
example/otel_postgres_example.dart— runnable example coveringexecuteTraced,tracedPostgresCall, and zone-scoped suppression.- Dartdoc for the suppression API.
0.1.0-beta.1 - 2026-05-16 #
Changed #
- Span name now follows OTel stable semconv:
{db.operation.name} {target}(e.g.SELECT users) with no system prefix. Previously emittedpostgresql SELECT users— the system is already indb.system.name=postgresql.
Added #
tracedPostgresCall<R>(...)— wraps an arbitrary Postgres call in a CLIENT-kind span with OTel DB semantic conventions.Session.executeTraced(...)extension — drop-in replacement forexecute(...)onConnectionandTxSession.- Best-effort SQL parsing for
db.operationanddb.collection.name(handlesSELECT … FROM,INSERT INTO …,UPDATE …,DELETE FROM …; ignores leading--and/* */comments). db.system=postgresql,db.namespace(when provided),db.query.text.- Error path records
error.type, callsrecordException, sets the span status toErrorbefore rethrowing. - Zone-scoped suppression via
runWithoutPostgresInstrumentation()/Async().