xraysql

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package xraysql provides AWS X-Ray tracing for SQL.

xraysql is drop-in replacement for database/sql. Use xraysql.Open instead of database/sql.Open.

db, err := xraysql.Open("postgres", "postgres://user:password@host:port/db")
if err != nil {
	panic(err)
}

row, err := db.QueryRowContext(ctx, "SELECT 1")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnector

func NewConnector(c driver.Connector, opts ...Option) driver.Connector

NewConnector wraps the connector.

func Open

func Open(driverName, dataSourceName string, opts ...Option) (*sql.DB, error)

Open is a drop-in replacement for database/sql.Open. It returns a *database/sql.DB that is instrumented for AWS X-Ray.

func OpenDB

func OpenDB(c driver.Connector, opts ...Option) *sql.DB

OpenDB is a drop-in replacement for database/sql.OpenDB. It returns a *database/sql.DB that is instrumented for AWS X-Ray.

Types

type Option

type Option func(*config)

Option is an option of SQL tracer.

func WithConnectionString

func WithConnectionString(str string) Option

WithConnectionString configures the data source name that is recorded in the X-Ray segment. By default, the tracer doesn't record the data source to avoid recording secrets such as passwords.

func WithName

func WithName(name string) Option

WithName configures the segment's name. By default, database_name@driver_name is used.

func WithURL

func WithURL(url string) Option

WithURL configures the url of data source that is recorded in the X-Ray segment. By default, the tracer doesn't record the data source to avoid recording secrets such as passwords.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL