Documentation ¶
Overview ¶
sqltracer implements a sql driver that wraps the original driver and adds Sentry tracing capabilities to all queries. The trace is valid if there is a parent span exists in the context.
Please note that when initializing the sqltracer, you will need to specify the `sqltracer.WithDatabaseSystem` option, so that Sentry will picks up the span as a correct query trace.
Example with "github.com/go-sql-driver/mysql" package.
package main import "github.com/go-sql-driver/mysql" import "github.com/aldy505/sentry-integration/sqltracer" func main() { sql.Register("sentrymysql", sqltracer.NewSentrySql(&mysql.MySQLDriver{}, sqltracer.WithDatabaseSystem("mysql"), sqltracer.WithDatabaseName("mydb"), sqltracer.WithServerAddress("localhost", "3306"))) db, err := sql.Open("sentrymysql", "username:password@protocol(address)/dbname?param=value") }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSentrySql ¶
func NewSentrySql(driver driver.Driver, options ...SentrySqlTracerOption) driver.Driver
func NewSentrySqlConnector ¶
func NewSentrySqlConnector(connector driver.Connector, options ...SentrySqlTracerOption) driver.Connector
Types ¶
type SentrySqlTracerOption ¶
type SentrySqlTracerOption func(*sentrySqlConfig)
func WithDatabaseName ¶
func WithDatabaseName(name string) SentrySqlTracerOption
func WithDatabaseSystem ¶
func WithDatabaseSystem(system string) SentrySqlTracerOption
func WithServerAddress ¶
func WithServerAddress(address string, port string) SentrySqlTracerOption
Click to show internal directories.
Click to hide internal directories.