英文:
Spring Boot 3 Webflux with Micrometer Tracing not showing as a one trace in the zipkin dashboard
问题
我的微服务应用有3个不同的微服务。其中许多只使用Spring Boot(命令式方式)创建,但这些应用程序的跟踪在仪表板上显示正常。但我使用Spring Boot 3创建了一个使用WebFlux的微服务应用程序。由于使用了Spring Boot 3,我必须使用Micrometer而不是Sleuth。
我的第三个应用程序向WebFlux应用程序发出HTTP请求。但我无法在同一跟踪下在仪表板中看到该跟踪的详细信息。WebFlux的跟踪在仪表板中显示为单独的跟踪。其他3个微服务的跟踪详细信息在一个跟踪下可用,但WebFlux的跟踪却不可见。
pom.xml文件和配置如下。
英文:
My Microservices application has 3 different Microservices. many of them have been created with just spring boot (imperative way) but those application's tracings are shown in the dashboard correctly. but I created one Microservice application by using spring boot 3 with webflux. because of using spring boot 3 I had to use micrometer instead of sleuth.
My 3rd application does make a http request to the webflux application. but that trace details I can't see in the dashboard under the same trace. that trace (webflux one) is shown as a separate one in the dashboard. other 3 Microservices' tracing details are available under one trace. but webflux's trace is not.
the pom.xml file and configuration like below.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>service-abc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>service-6</name>
<description>service-abc</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-instrumentation</artifactId>
<version>3.1.8</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
spring.application.name=service-abc
management.tracing.sampling.probability=1.0
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
server.port=5054
logging.level.org.springframework=debug
Main class (according to the doc https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide )
package com.example.service6;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import reactor.core.publisher.Hooks;
@SpringBootApplication
public class Service6Application {
public static void main(String[] args) {
SpringApplication.run(Service6Application.class, args);
Hooks.enableAutomaticContextPropagation();
}
}
I tried lots of examples in the website but I was unable to do that. please help me to solve this problem.
答案1
得分: 1
请确保您的reactor-core版本>= 3.5.7和micrometer context-propagation库的版本应>=1.0.4
您可以在此处获取有关此错误的更多信息。
此外,请在您的主类中添加以下内容:
Hooks.enableAutomaticContextPropagation();
英文:
For webflux Please make sure your reactor-core is >= 3.5.7 and micrometer context-propagation library which should be >=1.0.4
you can get more information about this bug here
Also please add this in your main class
Hooks.enableAutomaticContextPropagation();
答案2
得分: 0
Add propagation type in your properties file as b3
. because zipkin does support B3.
management.tracing.propagation.type=b3
英文:
Add propagation type in your properties file as b3
. because zipkin does support B3.
management.tracing.propagation.type=b3
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论