-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nrpostgres driver doesn't work with Sqlx named queries. #116
Comments
Hey @Jwonsever ! Thanks for opening this issue! I was able to test this out using your example and confirm that no Datastore metrics are created for NamedStmt's in sqlx. I've got both good and bad news though. I'll start with the good. I think there's a way to get around the need to fork sqlx. Instead of using sqldb, err := sql.Open("nrpostgres", "user=foo dbname=bar sslmode=disable")
if err != nil {
log.Fatalln(err)
}
db := sqlx.NewDb(sqldb, "postgres") This will allow your underlying sql.DB to use the Now, sadly, it seems even with this change that metrics will still not be created. That is because sql.Stmt exec and query calls are not supported with the Though it may not work for use case, I believe our mysql instrumentation will record metrics for sql.Stmt exec and query calls. Thanks again and keep us up to date with what you discover. We always love hearing from our users! |
Thanks, that appears to work, I'll let you know if I run into any side effects of the change. On the second topic, I ran into that and was able to switch to |
This PR is relevant. jmoiron/sqlx#401 . It would let us bind a custom driver, |
Hi, I've been investigating a hookup of newRelic to sqlx, using the example at https://github.com/newrelic/go-agent/blob/master/_integrations/nrpq/example/sqlx/main.go as a starting point.
I use sqlx named queries. They would go something (psuedocode) like:
However, sqlx uses the driver name to determine how to bind parameters to the query, and the 'nrpostgres' driver is not supported. You can see this at https://github.com/jmoiron/sqlx/blob/master/bind.go
it looks like the easiest way for me to get around this is to fork sqlx to allow the newrelic driver at this point, which I would ideally like to avoid. Are there any other options available to me?
The text was updated successfully, but these errors were encountered: