spring-attic / spring-cloud-gcp

Integration for Google Cloud Platform APIs with Spring
Apache License 2.0
704 stars 694 forks source link

Is there a way to trace JDBC calls for an application deployed on GKE? #2627

Closed Tritpi closed 2 years ago

Tritpi commented 3 years ago

Please confirm if there is an option to capture traces of the JDBC calls being made in an application deployed on GKE, so that using the trace list feature on the google cloud console the JDBC calls can be further analyzed.

meltsufin commented 3 years ago

I've never tried it, but I think the regular Sleuth/Brave instrumentation along with our Trace starter should do the trick. Have you tried it?

Tritpi commented 3 years ago

spring-cloud-starter-sleuth and spring-cloud-gcp-starter-trace are the dependencies added in the pom.xml file and tracing works as expected. There is a traceId that is generated on the fly when there is a call made and multiple span ids are generated for calls being made from the main method. There is no explicit code written for the generation of trace id and span ids.

I have not tried this approach for capturing traces for the JDBC calls made from an application deployed on GKE. Will try and update.

Tritpi commented 3 years ago

We tried the approach mentioned above and tried to hit an api which internally calls spanner DB, but the JDBC calls didn't get traced.

Please let me know if the approach followed is right.

elefeint commented 3 years ago

Our starters use Brave for instrumentation. It seems that there is support in brave-instrumentation-p6spy, but you need some additional configuration to enable it: https://github.com/openzipkin/brave/blob/master/instrumentation/p6spy/README.md

meltsufin commented 3 years ago

@Tritpi Are you using a JDBC driver to connect to Spanner? I guess the only option in Brave to instrument JDBC is the p6spy, like @elefeint suggested.