Allow sample to enable log collector with a property.

Property is sleuth.sample.logging.collector.enabled=true
This commit is contained in:
Spencer Gibb
2015-08-03 16:02:09 -06:00
parent df28936718
commit fcd1ada1ec
2 changed files with 9 additions and 5 deletions

View File

@@ -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();
}
}