Documentation ¶
Overview ¶
Package pgxtracer provides a tracer implementation for pgx.
databaseConfig, err := pgxpool.ParseConfig(fmt.Sprintf( "user=%s password=%s host=%s port=%d dbname=%s sslmode=disable pool_max_conn_lifetime=15m pool_max_conn_idle_time=30m pool_health_check_period=1m", configuration.Database.User, configuration.Database.Password, configuration.Database.Hostname, configuration.Database.Port, configuration.Database.Database)) if err != nil { return fmt.Errorf("parsing database configuration: %w", err) } databaseConf := databaseConfig.Copy() databaseConf.ConnConfig.Tracer = pgxtracer.NewSentryPgxTracer() database, err := pgxpool.NewWithConfig(c.Context, databaseConf) if err != nil { return fmt.Errorf("connecting to database: %w", err) } defer database.Close()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSentryPgxTracer ¶
func NewSentryPgxTracer(opts ...SentryPgxTracerOption) pgx.QueryTracer
Types ¶
type SentryPgxTracerOption ¶
type SentryPgxTracerOption func(*Tracer)
func WithDatabaseName ¶
func WithDatabaseName(databaseName string) SentryPgxTracerOption
func WithServerAddress ¶
func WithServerAddress(hostname string, port string) SentryPgxTracerOption
func WithTag ¶
func WithTag(key, value string) SentryPgxTracerOption
func WithTags ¶
func WithTags(tags map[string]string) SentryPgxTracerOption
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func (Tracer) TraceQueryEnd ¶
Click to show internal directories.
Click to hide internal directories.