简体   繁体   English

如何在Quarkus中启用Jaeger JDBC跟踪

[英]How do I enable Jaeger JDBC tracing in Quarkus

How do I enable Jaeger jdbc tracing in Quarkus ? 如何在Quarkus启用Jaeger jdbc跟踪? I've followed the Quarkus guides for Opentracing and didn't see any info about this. 我跟着Quarkus为导向Opentracing ,并没有看到这方面有任何信息。

I'm using Quarkus v0.21.2 with the following extensions: 我正在使用具有以下扩展名的Quarkus v0.21.2:

 -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. 而且我的代码只是一个基本的Rest终结点,它调用了我实体的Panache CRUD操作。

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. 我在Jaeger期望的是,2个跨度用于1条跟踪,一个跨度用于REST调用,另一个跨度用于JDBC调用。

But what I see is just 1 span for the REST call. 但是我看到的是REST调用只有1个跨度。

You can use opentracing java-jdbc extension it will works in Quarkus (I didn't test the native mode). 您可以使用opentracing java-jdbc扩展,它将在Quarkus中工作(我没有测试纯模式)。

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. 您需要使用版本0.0.12,因为最新版本基于Opentracing 0.33,但是Quarkus使用版本0.31。

  1. Add the dependency to your pom.xml: 将依赖项添加到您的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: 更新您的application.properties以使用opentracing-jdbc驱动程序,以下适用于Postgres数据库:

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. 然后,您将在Jaeger中看到SQL查询为跨度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM