newrelic / go-agent

New Relic Go Agent
Apache License 2.0
762 stars 294 forks source link

Add Google Cloud SQL Postgresql Proxy Driver #267

Open arnulfosuarez opened 3 years ago

arnulfosuarez commented 3 years ago

Summary

We have a Postgresql server in Google Cloud, but when i try to instrument with the nrpostgresql driver I got an error of the host, we are using the cloudsqlpostgres provided by Google and here the host differ, because is expecting and instance.

Desired Behaviour

Have a SQL driver for cloudsqlpostgres that is the Google Cloud SQL Proxy driver to connect to the database. For the moment it should have the same behavior that the nrpostgresql. There is another Issue about capturing the full SQL query like other agents.

Possible Solution

I can do a Pull Request, as far as I saw, is almost same implementation that the current nrpostgresql but with the driver cloudsqlpostgres. Also i think the other change is the validation of the host.

Additional context

Without this driver I can't intrument the database calls from my application, doing it in a manually fashion will not be possible. This is the package of the driver that we are using: https://github.com/GoogleCloudPlatform/cloudsql-proxy/tree/master/proxy/dialers/postgres

Ak-x commented 1 year ago

Hello @arnulfosuarez , our team would be interested in a pull request if you are available to create one.