XSAM / otelsql

OpenTelemetry instrumentation for database/sql
Apache License 2.0
299 stars 51 forks source link

Fallback NamedValueChecker from Stmt to Conn #243

Closed XSAM closed 5 months ago

XSAM commented 5 months ago

The [database/sql] package checks for value checkers in the following order, stopping at the first found match: Stmt.NamedValueChecker, Conn.NamedValueChecker, Stmt.ColumnConverter, [DefaultParameterConverter].

Since otelsql implements the NamedValueChecker for both Stmt and Conn, the fallback logic in the Go is not working. Source: https://go.googlesource.com/go/+/refs/tags/go1.22.2/src/database/sql/convert.go#128

This is a workaround to make sure the named value checker is checked on the connection level after the statement level.


This also resolves #117

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.1%. Comparing base (5112030) to head (eaccc86).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #243 +/- ## ======================================= + Coverage 82.4% 84.1% +1.6% ======================================= Files 13 13 Lines 604 605 +1 ======================================= + Hits 498 509 +11 + Misses 82 72 -10 Partials 24 24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.