如何在Quarkus中启用Jaeger JDBC跟踪 [英] How do I enable Jaeger JDBC tracing in Quarkus

查看:238
本文介绍了如何在Quarkus中启用Jaeger JDBC跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Quarkus中启用Jaeger jdbc跟踪?我已经按照OpentracingQuarkus指南进行操作,但是没有看到任何有关此的信息.

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.

我正在使用具有以下扩展名的Quarkus v0.21.2:

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

我的代码只是一个基本的Rest终结点,它调用了我实体的Panache CRUD操作.

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

感谢您的帮助.

我尝试了以下方法,但没有用:

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

Jaeger中我期望的是,2个跨度用于1条迹线,一个跨度用于REST调用,另一个跨度用于JDBC调用.

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

但是我看到的REST调用只有1个跨度.

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

推荐答案

您可以使用opentracing java -jdbc 扩展名,它将在Quarkus中运行(我没有测试纯模式).

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

您需要使用版本0.0.12,因为最新版本基于Opentracing 0.33,而Quarkus使用版本0.31.

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. 将依赖项添加到pom.xml:

  1. Add the dependency to your pom.xml:

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-jdbc</artifactId>
  <version>0.0.12</version>
</dependency>

  • 更新您的application.properties以使用opentracing-jdbc驱动程序,以下适用于Postgres数据库:

  • 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
    

    然后您将在Jaeger中看到SQL查询为跨度.

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

    这篇关于如何在Quarkus中启用Jaeger JDBC跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆