Search code examples
springspring-jdbcspring-cloud-sleuthdistributed-tracingp6spy

spring boot with p6spy sleuth traces interpretation


We have been using spring cloud sleuth in our micoservices for tracing. We have also added enabled jdbc level spans from spring data Repository connection, fetch and query. I am seeing some weird jps traces of name jdbc:/datasource/connection which seem to include some of my service specific spans. I was of the view that a parent span includes only those spans as kids, which it calls.

enter image description here

venderproxy, profile:fetchorganization are my other services' grpc endpoints, why is jdbc:/datasource/connection span in supplier including some of my services under it?


Solution

  • I got the answer from one of the author of p6spy.

    jdbc:/datasource/connection span represents open connection (transaction), in this case you're most likely haven't closed the connection and calling other services? For example you might be calling other services from the method annotated with @Transactional. While it might be ok for some scenarios, it can cause issues with connection pool if you're holding connection open for 12s.