Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot version 3.0.0 not working with jaeger #146

Open
prasad5252 opened this issue Dec 20, 2022 · 5 comments
Open

spring boot version 3.0.0 not working with jaeger #146

prasad5252 opened this issue Dec 20, 2022 · 5 comments

Comments

@prasad5252
Copy link

prasad5252 commented Dec 20, 2022

i am using jaeger with spring boot version 3.0.0 and java version 17 but unable to discover any services that registered with jaeger UI, is there version issue ? jaeger doen't support spring boot 3.0.0 ?

@onyn
Copy link

onyn commented Jan 13, 2023

Spring boot 3.0 removes support of spring.factories.

As temporary workaround you may create plain text file META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports and put io.opentracing.contrib.java.spring.jaeger.starter.JaegerAutoConfiguration into it.

onyn pushed a commit to onyn/java-spring-jaeger that referenced this issue Jan 13, 2023
Spring boot 2.7 introduces new way for registering autoconfiguration classes.
And then spring.factories file was deprecated.
As of boot 3.0 support of spring.factories files was dropped.

See also:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#auto-configuration-files
onyn pushed a commit to onyn/java-spring-jaeger that referenced this issue Jan 13, 2023
Spring boot 2.7 introduces new way for registering autoconfiguration classes.
And then spring.factories file was deprecated.
As of boot 3.0 support of spring.factories files was dropped.

Closes: opentracing-contrib#146

See also:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#auto-configuration-files
@tweetysat
Copy link

I'm using spring boot 3.0.0 and

    <dependency>
        <groupId>io.opentracing.contrib</groupId>
        <artifactId>opentracing-spring-jaeger-web-starter</artifactId>
        <version>3.3.1</version>
    </dependency>

As @onyn suggested I tried adding that file in my project but it is not working.

The only way I found to have something happening is to add

@Component
public class JaegerConfiguration {

    @Bean
    public static JaegerTracer jaegerTracer(
            @Value("${spring.application.name}") String serviceName
    ) {
        return new Configuration(serviceName)
                .withSampler(new io.jaegertracing.Configuration.SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1))
                .withReporter(new io.jaegertracing.Configuration.ReporterConfiguration().withLogSpans(true))
                .getTracer();
    }

}

Now I can see

2023-02-01T11:59:30.120+01:00  INFO 12392 --- [  restartedMain] io.jaegertracing.Configuration           : Initialized tracer=JaegerTracer(version=Java-1.3.2, serviceName=mailbox-dispatcher, reporter=CompositeReporter(reporters=[RemoteReporter(sender=UdpSender(host=localhost, port=6831), closeEnqueueTimeout=1000), LoggingReporter(logger=Logger[io.jaegertracing.internal.reporters.LoggingReporter])]), sampler=ConstSampler(decision=true, tags={sampler.type=const, sampler.param=true}), tags={hostname=xxx, jaeger.version=Java-1.3.2, ip=xxx}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false)

BUT .... I don't konw how to use a http-sender in place of a udp-sender and change the url.

I tried adding

opentracing:
  jaeger:
    enabled: true
    http-sender:
      url: http://myurl:14268/api/traces

But it always tells me reporter=CompositeReporter(reporters=[RemoteReporter(sender=UdpSender(host=localhost, port=6831)

@akshayrana30
Copy link

Can also use this in one of the config classes.

@ImportAutoConfiguration(io.opentracing.contrib.java.spring.jaeger.starter.JaegerAutoConfiguration.class)

@kayeanni
Copy link

I am facing the same problem, were you able to make it work?

@onyn
Copy link

onyn commented Jun 22, 2023

@kayeanni, switch from jaeger to micrometer tracing. This is best solution in long term.

See also #148 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants