spring-projects-experimental / spring-cloud-sleuth-otel

Spring Cloud Sleuth support for OpenTelemetry
https://spring-projects-experimental.github.io/spring-cloud-sleuth-otel/docs/current/reference/html/
Apache License 2.0
111 stars 33 forks source link

SpanReporters not registered #80

Closed gquintana closed 3 years ago

gquintana commented 3 years ago

Describe the bug SpanReporters are not registered in SdkTracerProvider

  1. OtelExporterConfiguration.java#L59 : reporters.getIfAvailable(ArrayList::new) returns an empty list during init
  2. OtelAutoConfiguration.java#L97 : reporters.getIfAvailable(ArrayList::new) now returns a list containing to elements
  3. OtelAutoConfiguration.java#L98 + OtelExporterConfiguration.java#L62 each SpanExporter gets replaced by an empty CompositeSpanExporter

The behaviour seems to change depending on the order of Spring beans initialization

Sample

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
<version>3.1.0-M1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-sleuth-brave</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
                <version>1.1.0-M1</version>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-exporter-otlp</artifactId>
                <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-exporter-logging</artifactId>
                <version>1.5.0</version>
        </dependency>
marcingrzejszczak commented 3 years ago

Hi! Do you have a small sample that reproduces this problem? It will be easier for us to fix this if you have one

marcingrzejszczak commented 3 years ago

So I tested that the OTLP GRPC exporter gets registered properly, the problem was with the logging one. A property needed to be explicitly added which doesn't make sense. So I've changed that.

sardorn commented 3 years ago

@marcingrzejszczak Any idea when this project will come out of incubation? Since tracing is in GA, as well as otel collector for tracing is also GA, any plans to release a version of sleuth-otel soon?

jonatan-ivanov commented 3 years ago

@sardorn OTel Tracing is not GA; once OTel goes GA we will consider making this GA (or merge it to Sleuth), see the details in https://github.com/spring-cloud-incubator/spring-cloud-sleuth-otel/issues/56#issuecomment-848944920.