Updates for sleuth 2 changes
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
package demo;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import brave.Tracer;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.cloud.sleuth.Tracer;
|
||||
import org.springframework.cloud.sleuth.trace.DefaultTracer;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@DirtiesContext
|
||||
public class TraceApplicationTests {
|
||||
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
Tracer traceManager;
|
||||
|
||||
@Test
|
||||
@@ -26,6 +25,6 @@ public class TraceApplicationTests {
|
||||
|
||||
@Test
|
||||
public void traceIsDefaultTrace() {
|
||||
assertTrue("trace is wrong type", this.traceManager instanceof DefaultTracer);
|
||||
assertNotNull("Tracer was null", this.traceManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.sleuth.Span;
|
||||
import org.springframework.cloud.sleuth.SpanAdjuster;
|
||||
import org.springframework.cloud.sleuth.zipkin2.EndpointLocator;
|
||||
import org.springframework.cloud.sleuth.zipkin2.ZipkinSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@@ -22,7 +12,7 @@ public class ZipkinApplication {
|
||||
private static Logger log = LoggerFactory.getLogger(ZipkinApplication.class);
|
||||
|
||||
// Use this for debugging (or if there is no Zipkin server running on port 9411)
|
||||
@Bean
|
||||
/*@Bean
|
||||
@ConditionalOnProperty(value="sample.zipkin.enabled", havingValue="false")
|
||||
public ZipkinSpanReporter spanCollector(Reporter<zipkin2.Span> reporter, EndpointLocator endpointLocator, Environment environment, List<SpanAdjuster> spanAdjusters) {
|
||||
return new ZipkinSpanReporter(reporter, endpointLocator, environment, spanAdjusters) {
|
||||
@@ -31,7 +21,7 @@ public class ZipkinApplication {
|
||||
log.info("Reporting span [{}]", span);
|
||||
}
|
||||
};
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ZipkinApplication.class, args);
|
||||
|
||||
Reference in New Issue
Block a user