Documentation
¶
Overview ¶
Package dbobs opens the platform's PostgreSQL pool through a driver wrapper that observes every statement (#1896): a client span per statement under the caller's span, a db_client_operation_duration_seconds{operation} observation, and a db_client_slow_statements_total count and WARN for a statement at or over the slow threshold.
The operation is the statement's leading keyword (select, insert, update, ...), vector_search for a statement that ranks by a pgvector distance, and the transaction or connection step otherwise (begin, commit, rollback, prepare, connect, ping). A vector search is its own operation and its own span name, so what vector ranking costs is separable from ordinary queries without touching the call sites that rank.
The SQL text is not on the span unless OTEL_TRACES_INCLUDE_DB_STATEMENT is set: a statement can quote the values it was built with, and a trace backend is outside the platform. A statement made outside any traced request (a background sweep) opens no span, so the trace backend does not fill with root spans nobody can place.
Index ¶
Constants ¶
const OpVectorSearch = "vector_search"
OpVectorSearch is the operation of a statement that ranks by a pgvector distance operator.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open opens the pool on dsn with every statement observed, recording through m (nil records nothing) and reading the slow threshold and the statement opt-in from the environment (observability.DBConfigFromEnv).
func Options ¶
func Options(m *observability.Metrics, cfg observability.DBConfig) []otelsql.Option
Options are the driver wrapper's options for m and cfg.
Types ¶
This section is empty.