go-sensor
go-sensor copied to clipboard
poc: refactoring sql instrumentation
This PR optimizes the creation of SQL span tags by decoupling tag generation from query execution. Currently, all span tags—including connection details, which are constants—are generated during query execution. This change moves the creation of these constant tags to the connection setup phase, allowing them to be reused across multiple queries executed through the same connection instance.
Additionally, span creation is now handled by a single object, enabling easier extension and the incorporation of more data in the future. A Tags
interface has been introduced to streamline the process of adding tags to spans, ensuring efficient tag management. This refactor also aims to improve code structure, enabling cleaner design and facilitating future expansion.
By leveraging a single object for span creation, rather than passing parameters and constructing tags for each query, the changes are expected to improve the overall performance of the application.