Spring Cloud Sleuth не добавляет ключи в журналы запросов Hibernate - PullRequest
1 голос
/ 20 марта 2019

Когда я использую Spring Cloud Sleuth, я наблюдаю, что он добавляет имя приложения и ключевые сведения для всех журналов приложений.

Но этого не происходит для журналов Hibernate или запросов jpa.

Есть ли способ добиться этого, используя sleuth

1 Ответ

0 голосов
/ 05 апреля 2019

Вы можете проверить интеграцию Brave с JDBC через py6spy - https://github.com/openzipkin/brave/tree/master/instrumentation/p6spy

Выписка из документов:

brave-instrumentation-p6spy

This includes a tracing event listener for P6Spy (a proxy for calls to your JDBC driver). It reports to Zipkin how long each statement takes, along with relevant tags like the query.

P6Spy requires a spy.properties in your application classpath (ex src/main/resources). brave.p6spy.TracingP6Factory must be in the modulelist to enable tracing.

modulelist=brave.p6spy.TracingP6Factory
url=jdbc:p6spy:derby:memory:p6spy;create=true

In addition, you can specify the following options in spy.properties

remoteServiceName

By default the zipkin service name for your database is the name of the database. Set this property to override it

remoteServiceName=myProductionDatabase

includeParameterValues

When set to to true, the tag sql.query will also include the JDBC parameter values.

Note: if you enable this please also consider enabling 'excludebinary' to avoid logging large blob values as hex (see http://p6spy.readthedocs.io/en/latest/configandusage.html#excludebinary).

includeParameterValues=true
excludebinary=true

spy.properties applies globally to any instrumented jdbc connection. To override this, add the zipkinServiceName property to your connection string.

jdbc:mysql://127.0.0.1:3306/mydatabase?zipkinServiceName=myServiceName

This will override the remoteServiceName set in spy.properties.

The current tracing component is used at runtime. Until you have instantiated brave.Tracing, no traces will appear.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...