Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib/sql/driver: use the connector provided by the sql driver if p…
…ossible (#1502) * contrib/sql/driver: use the connector provided by the sql driver if possible Currently, when the sql tracer opens a new database with the Open(...) function, it uses a default dsnConnector. However, if the driver implements the `DriverContext` interface, the one provided by the `OpenConnector(...)` method on the driver should be used instead. And the documentation on the sql library says that the `DriverContext` should be implemented : > The driver interface has evolved over time. Drivers should implement Connector and DriverContext interfaces. (from: https://pkg.go.dev/database/sql/driver@go1.19.2) This commit uses the connector provided by the sql driver if it implements the `DriverContext` and follows the same logic as the std lib sql library: https://github.com/golang/go/blob/515e3de2999b23da28e6d15ac485bfdd299ec83a/src/database/sql/sql.go#L821-L829 * Empty Commit to re-trigger CI Co-authored-by: Andrew Glaude <andrew.glaude@datadoghq.com> Co-authored-by: Alex Normand <alex.normand@datadoghq.com>
- Loading branch information