Allow sample to enable log collector with a property.
Property is sleuth.sample.logging.collector.enabled=true
This commit is contained in:
@@ -32,7 +32,7 @@ logging:
|
||||
|
||||
WARNING: The docker images for zipkin are old and don't work very well (the UI in particular). Zipkin is in a state of flux, but it should settle down soon when there is an actual release. Best results actually come from building from source and running the jar files (the query and collector services need command line arguments, so check the zipkin README for updates).
|
||||
|
||||
NOTE: You can see the zipkin spans without the UI (in logs) if you just provide a `@Bean` of type `LogSpanCollector` (there's one commented out in the sample).
|
||||
NOTE: You can see the zipkin spans without the UI (in logs) if you run the sample with `sleuth.sample.logging.collector.enabled=true`.
|
||||
|
||||
== Building
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.springframework.cloud.sleuth.sample;
|
||||
|
||||
import com.github.kristofa.brave.LoggingSpanCollectorImpl;
|
||||
import com.github.kristofa.brave.SpanCollector;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.sleuth.Sampler;
|
||||
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -33,9 +36,10 @@ public class SampleApplication {
|
||||
}
|
||||
|
||||
// Use this for debugging (or if there is no Zipkin collector running on port 9410)
|
||||
// @Bean
|
||||
// public SpanCollector spanCollector() {
|
||||
// return new LoggingSpanCollectorImpl();
|
||||
// }
|
||||
@Bean
|
||||
@ConditionalOnProperty("sleuth.sample.logging.collector.enabled")
|
||||
public SpanCollector spanCollector() {
|
||||
return new LoggingSpanCollectorImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user