Does quarkus reactive sql client support tracing?

77 Views Asked by At

I was trying to enable jdbc tracing in my quarkus service.

I had quarkus.datasource.jdbc.tracing=true in the property file, and implementation "io.opentracing.contrib:opentracing-jdbc:0.2.15" in the gradle build file.

The migration was done through flyway (implementation 'io.quarkus:quarkus-flyway') and all sql queries to handle the business logic is done through the reactive postgres client (implementation 'io.quarkus:quarkus-reactive-pg-client').

I use datadog to gather the traces.

          - -Ddd.trace.propagation.style.inject=datadog,b3multi
          - -Ddd.trace.propagation.style.extract=datadog,b3multi
          - -Ddd.agent.host=$(DD_AGENT_HOST)
          - -Ddd.integrations.enabled=true
          - -Ddd.trace.enabled=true
          - -Ddd.logs.injection=true
          - -Ddd.jmxfetch.enabled=false
          - -Ddd.dbm.propagation.mode=full
          - -Ddd.integration.jdbc-datasource.enabled=true
          - -javaagent:/deployments/dd-java-agent.jar
          - -Ddd.profiling.enabled=false

After the service is deployed, I can observe traces from datadog. There are traces for DB migration, such as enter image description here I can also see the traces for http request: enter image description here However, for such request that queries the postgres, I am expecting spans of postgres query, but there are none.

Does quarkus reactive sql client support tracing? There are no documents from (https://quarkus.io/guides/reactive-sql-clients). From the data source document (https://quarkus.io/guides/datasource), tracing seems to be only supported in the non-reactive data source?

1

There are 1 best solutions below

0
Bruno Baptista On

With reactive stack you don't need io.opentracing.contrib:opentracing-jdbc the reactive stack doesn't use JDBC but the quarkus-reactive-pg-client. You probably get that error because there are no recognisable tracing frameworks on the classpath.

There are many tracing frameworks and you need to choose one, just saying you want tracing without specifying an instrumentation framework, won't create or send your traces anywhere.

On Quarkus we recommend OpenTelemetry Tracing. For reactive applications these are the recommended dependencies:

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-hibernate-reactive</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-reactive-pg-client</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-opentelemetry</artifactId>
    </dependency>