opentracing-contrib / java-spring-cloud

Distributed tracing for Spring Boot, Cloud and other Spring projects
Apache License 2.0
390 stars 143 forks source link

RxJava instrumentation not working via auto configuration #304

Open akashsolanki opened 4 years ago

akashsolanki commented 4 years ago

RxJava app does not send any trace to Jaeger automatically. It only works using a manual Tracer Configuration and wrapping the subscribers and observers in the Tracer decorators (like in this app).

Please see this stackoverflow question for details.

Is this expected? Shouldn't it work automatically without having to configure a Tracer bean?

Below is my pom.xml

<?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>2.3.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example.springcloud</groupId>
    <artifactId>rxjava</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>rxjava</name>
    <description>RxJava Spring Cloud</description>

    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>Hoxton.SR6</spring-cloud.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.opentracing.contrib</groupId>
            <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
            <version>3.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.reactivex</groupId>
            <artifactId>rxjava</artifactId>
            <version>1.3.8</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
julianocosta89 commented 4 years ago

Just adding a little bit of context here, all the other Spring Cloud instrumentation samples didn't require to instrument anything. All is done automatically, that's why I was expecting the same behavior for RxJava.

Instrumenting all the Rx objects and adding @Bean works, but that's a manual task and it's different from all the other cases.