Search code examples
javaquarkusvert.xopen-telemetry

Disable OpenTelemetry tracing on quarkus for vertx reactive


I am currently attempting to add openTelemetry tracing to my quarkus project. It is a lambda that reaches out to datasources and does some processing. Currently, we are using reactive pgadmin, but when I try to make queries when using the quarkus-opentelemetry-exporter-otlp import, I get this error class io.vertx.sqlclient.impl.tracing.QueryRequest cannot be cast to class io.vertx.core.spi.observability.HttpRequest (io.vertx.sqlclient.impl.tracing.QueryRequest and io.vertx.core.spi.observability.HttpRequest are in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @4b3ed2f0). This code does not show this error when OpenTelemetry is not included in the pom.xml of this project.

I would like this request to be able to go through, or simply turn off open tracing for vertx requests. However, I have read through the quarkus documentation and am not sure how to do that. One approach I can think of is creating a provider to create the PgPool since there is a TracingPolicy.IGNORE that I can perhaps set in the PGPoolConnectionOptions.

Here is my code stack:

pom.xml
<quarkus-plugin.version>2.6.0.Final</quarkus-plugin.version>

<dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-opentelemetry-exporter-otlp</artifactId>
</dependency>
 <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-pg-client</artifactId>
        </dependency>
Code:

import io.vertx.mutiny.pgclient.PgPool;

@Inject
@ReactiveDataSource("important")
PgPool pool;

pool.preparedQuery(QUERY.sql()).executeAndAwait(...

TLDR: How do I turn of tracing on on openetelemetry quarkus stack for vertx queries.


Solution

  • The exception you mention has been fixed in https://github.com/quarkusio/quarkus/pull/22809 which first became available in Quarkus 2.6.3.Final