How do I enable Jaeger JDBC tracing in Quarkus

Serkan :

How do I enable Jaeger jdbc tracing in Quarkus? I've followed the Quarkus guides for Opentracing and didn't see any info about this.

I'm using Quarkus v0.21.2 with the following extensions:

 -quarkus-smallrye-opentracing
 -quarkus-resteasy
 -quarkus-resteasy-jackson
 -quarkus-hibernate-orm-panache
 -quarkus-jdbc-postgresql
 -quarkus-smallrye-openapi

And my code is just a basic Rest endpoint which calls my entity's Panache CRUD operation.

Any help is appreciated.

I've tried the following and it didn't work:

 - added @Traced to my entity
 - changed quarkus.jaeger.sampler-type=const into quarkus.jaeger.sampler-type=remote

What I expect in Jaeger is, 2 spans for 1 trace, one for the REST call and another one for the JDBC call.

But what I see is just 1 span for the REST call.

loicmathieu :

You can use opentracing java-jdbc extension it will works in Quarkus (I didn't test the native mode).

You need to use the version 0.0.12 as the latest one is based on Opentracing 0.33 but Quarkus use the version 0.31.

  1. Add the dependency to your pom.xml:

    <dependency>
      <groupId>io.opentracing.contrib</groupId>
      <artifactId>opentracing-jdbc</artifactId>
      <version>0.0.12</version>
    </dependency>
    
  2. Update your application.properties to use the opentracing-jdbc driver, the following are for a Postgres database:

quarkus.datasource.url = jdbc:tracing:postgresql://localhost:5433/mydatabase
quarkus.datasource.driver = io.opentracing.contrib.jdbc.TracingDriver
quarkus.hibernate-orm.dialect = org.hibernate.dialect.PostgreSQLDialect

You will then saw the SQL queries in Jaeger as spans.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=329319&siteId=1