instrumentedsql
instrumentedsql copied to clipboard
Does this library work with sqlx?
I tried using this library with sqlx, but I cannot get it working.
Any ideas how to solve this problem? My goal is to make instrumentedsql
work with named queries.
My code bebfore:
db, err := sqlx.Open("postgres", config.DB.URL)
after:
sql.Register("instrumented-postgres", instrumentedsql.WrapDriver(&pq.Driver{}, instrumentedsql.WithTracer(opentracingsql.NewTracer())))
db, err := sql.Open("instrumented-postgres", config.DB.URL)
Tracing works just fine, but now I get "pq: syntax error at end of input"
errors.
I managed to get sqlx
working with the pq
driver and instrumentedsql
using the following code:
sql.Register("instrumented-postgres", instrumentedsql.WrapDriver(&pq.Driver{}, instrumentedsql.WithTracer(opentracingsql.NewTracer())))
db, err := sql.Open("instrumented-postgres", config.DB.URL)
...
dbx := sqlx.NewDb(db, "postgres")
Thanks @pavelnikolov! you saved my day!