Skip to content

instrumentDriver() register wrapped driver per driver instead of per connection #725

@sio4

Description

@sio4

The function instrumentDriver() registers a custom SQL driver with sql.Register() and it uses a decorated driver name as something like instrumented-sql-driver-sqlite3 which is based on the driver name but actually it used wrapper options per connection. So if there are two or more connections with the same driver, only one wrapped driver will be registered with the wrapper option of the first successful connection.

The purpose of the wrapped driver is to support logging, tracing, etc. and those actions can be applied to each connection with different settings.

func instrumentDriver(deets *ConnectionDetails, defaultDriverName string) (driverName, dialect string, err error) {

See this and the following comments for more details.

Related Issues or PRs

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions