Is there any way to trace cloud sql calls in app e

2019-05-23 06:22发布

问题:

I am trying to optimise performance in an app-engine Java app using cloud sql gen2. It would help a lot if I could trace calls to cloud sql just like I can trace RPC calls to the datastore in the stackdriver trace details. Is this somehow possible, or maybe planned? Or is the only alternative to do log.info() calls with milliseconds? Or is there some other way to add event markers for tracing / profiling?

回答1:

There's now Google Cloud Trace for JDBC for exactly this use case.

Google Cloud Trace for JDBC is a custom JDBC driver which intercepts calls to the actual JDBC driver (e.g. Cloud SQL's) and collects and sends latency data about JDBC calls to Stackdriver Trace for visualization in the Google Cloud Console.

Here's how the trace details look like in the Google Cloud Console for an example request:

Please see the Github page for Google Cloud Trace for JDBC for more details. I'm happy to help with any issues (I'm the author).