How to disable zipkin reporter in spring boot 3?
Asked Answered
V

5

8

In spring boot 2 it was possible to disable distributed tracing during development as described here. Locally, traces were still generated but not exported.

In spring boot 3 it is possible it disable tracing at all with:

     management.tracing.enabled=false

How can I disable the zipkin reporter or distributed tracing in spring boot 3 but keep local tracing on?

Votary answered 16/2, 2023 at 15:39 Comment(2)
You have to exclude io.zipkin.reporter2:zipkin-reporter-brave dependencySaddlery
@Saddlery it removes zipkin, but we need to just disable so we dont have separate builds with or without zipkin.Silkstocking
S
1

Maybe by setting this property to 0.0?

management.tracing.sampling.probability: 0.0
Stalagmite answered 23/2, 2023 at 7:53 Comment(2)
This actualy doesn't help. App anyway tries to send spans to zipkin url at first call.Walhalla
Should not be accepted answer as it does not solve problemSilkstocking
R
7

You can disable zipkin via spring config:

spring:
  autoconfigure:
    exclude: org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration
Roana answered 17/10, 2023 at 21:21 Comment(0)
D
3

After going through a lot of posts, I concluded that it is not supported to-date. So the workaround that I have for now have three pieces

1.

@SpringBootApplication(exclude = ZipkinAutoConfiguration.class)
public class SomeSpringApplication {
    ....
}
@Configuration
@Import(ZipkinAutoConfiguration.class)
@ConditionalOnProperty(prefix = "management.tracing.zipkin", name = "enabled", matchIfMissing = true)
public class ZipKinEnvConfig {
}
  1. In your properties file:

    management.tracing.zipkin.enabled=false

If this property exists as false, local traces will work and not sent to Zipkin. If this property is true or not existing, traces will be sent out. I believe this is the same behavior as Spring 2.X property. The only annoying part to make this generic is the annotation on SpringBootApplication file :(

Daybook answered 9/9, 2023 at 0:59 Comment(0)
S
2

In Spring Boot >=3.0 and <3.4 you need to exclude autoconfig:

spring:
  autoconfigure:
    exclude: org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration

Since Spring Boot 3.4 you can use property to disable/enable exporting spans to zipkin. So no need for excluding autocofig.

management:
  zipkin:
    tracing:
      export:
        enabled: false
Silkstocking answered 26/7, 2024 at 10:2 Comment(0)
S
1

Maybe by setting this property to 0.0?

management.tracing.sampling.probability: 0.0
Stalagmite answered 23/2, 2023 at 7:53 Comment(2)
This actualy doesn't help. App anyway tries to send spans to zipkin url at first call.Walhalla
Should not be accepted answer as it does not solve problemSilkstocking
P
-1

Check and remove this dependency

<dependency>
    <groupId>io.zipkin.reporter2</groupId>
    <artifactId>zipkin-reporter-brave</artifactId>
</dependency>

or any other reporter dependency...

Patsypatt answered 25/5, 2023 at 14:51 Comment(1)
We want to disable zipkin not remove.Silkstocking

© 2022 - 2025 — McMap. All rights reserved.