Disable distributed tracing for development
Asked Answered
M

2

10

We are setting up microservice framework.

We use following stack for distributed tracing.

  • Spring boot
  • Kafka
  • Zipkin

Following is how the configuration is done

In gradle.build (or pom.xml) following starter dependencies added

compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
compile 'org.springframework.cloud:spring-cloud-sleuth-zipkin'
compile 'org.springframework.cloud:spring-cloud-starter-bus-kafka'

Add one AlwaysSampler bean

@Bean
public Sampler defaultSampler() {
    return Sampler.ALWAYS_SAMPLE;
}

If we have kafka running, things work automatically.

But if kafka is not running, server does not start - this is mostly the case for development environment.

If I want to stop this, I have to comment out all the code mentioned here (as we use starter dependency with spring boot, it automatically configures as I understand).

Can we just make some changes in properties (or yaml) files so that I don't need to go and comment out all these code?

Or probably another way to disable this without doing some commenting, etc.

Modillion answered 10/6, 2019 at 11:11 Comment(0)
E
26

You can add the following setting on your properties key to disable zipkin, source.

spring.zipkin.enabled=false

Better yet, create separate development properties (like application-dev.properties) to avoid changing above setting everytime you want to run in your machine: https://mcmap.net/q/382979/-spring-use-one-application-properties-for-production-and-another-for-debug

Encincture answered 10/6, 2019 at 15:54 Comment(0)
C
1

For Spring Boot 3, this would be:

management.tracing.enabled=false
Canny answered 19/8, 2023 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.