本文整理汇总了Java中org.springframework.cloud.sleuth.log.NoOpSpanLogger类的典型用法代码示例。如果您正苦于以下问题:Java NoOpSpanLogger类的具体用法?Java NoOpSpanLogger怎么用?Java NoOpSpanLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoOpSpanLogger类属于org.springframework.cloud.sleuth.log包,在下文中一共展示了NoOpSpanLogger类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: should_pass_tracing_information_when_using_Hystrix_commands
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_pass_tracing_information_when_using_Hystrix_commands() {
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
new DefaultSpanNamer(), new NoOpSpanLogger(), new NoOpSpanReporter());
TraceKeys traceKeys = new TraceKeys();
HystrixCommand.Setter setter = HystrixCommand.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("group"))
.andCommandKey(HystrixCommandKey.Factory.asKey("command"));
// tag::hystrix_command[]
HystrixCommand<String> hystrixCommand = new HystrixCommand<String>(setter) {
@Override
protected String run() throws Exception {
return someLogic();
}
};
// end::hystrix_command[]
// tag::trace_hystrix_command[]
TraceCommand<String> traceCommand = new TraceCommand<String>(tracer, traceKeys, setter) {
@Override
public String doRun() throws Exception {
return someLogic();
}
};
// end::trace_hystrix_command[]
String resultFromHystrixCommand = hystrixCommand.execute();
String resultFromTraceCommand = traceCommand.execute();
then(resultFromHystrixCommand).isEqualTo(resultFromTraceCommand);
then(tracer.getCurrentSpan()).isNull();
}
示例2: should_pass_tracing_information_when_using_Hystrix_commands
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_pass_tracing_information_when_using_Hystrix_commands() {
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
new DefaultSpanNamer(), new NoOpSpanLogger(), new NoOpSpanReporter(), new TraceKeys());
TraceKeys traceKeys = new TraceKeys();
HystrixCommand.Setter setter = withGroupKey(asKey("group"))
.andCommandKey(HystrixCommandKey.Factory.asKey("command"));
// tag::hystrix_command[]
HystrixCommand<String> hystrixCommand = new HystrixCommand<String>(setter) {
@Override
protected String run() throws Exception {
return someLogic();
}
};
// end::hystrix_command[]
// tag::trace_hystrix_command[]
TraceCommand<String> traceCommand = new TraceCommand<String>(tracer, traceKeys, setter) {
@Override
public String doRun() throws Exception {
return someLogic();
}
};
// end::trace_hystrix_command[]
String resultFromHystrixCommand = hystrixCommand.execute();
String resultFromTraceCommand = traceCommand.execute();
then(resultFromHystrixCommand).isEqualTo(resultFromTraceCommand);
then(tracer.getCurrentSpan()).isNull();
}
示例3: setup
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Before
public void setup() {
this.tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
new DefaultSpanNamer(), new NoOpSpanLogger(), this.spanAccumulator);
this.template.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList(
new TraceRestTemplateInterceptor(this.tracer, new HttpRequestInjector(),
new HttpTraceKeysInjector(this.tracer, new TraceKeys()))));
TestSpanContextHolder.removeCurrentSpan();
}
示例4: setup
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Before
public void setup() {
this.tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
new DefaultSpanNamer(), new NoOpSpanLogger(), new NoOpSpanReporter());
this.template.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList(
new TraceRestTemplateInterceptor(this.tracer, new HttpRequestInjector(),
new HttpTraceKeysInjector(this.tracer, new TraceKeys()))));
TestSpanContextHolder.removeCurrentSpan();
}
示例5: setup
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Before
public void setup() {
this.tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
this.spanNamer, new NoOpSpanLogger(), new NoOpSpanReporter());
this.traceManagerableExecutorService = new TraceableExecutorService(this.executorService,
this.tracer, new TraceKeys(), this.spanNamer);
TestSpanContextHolder.removeCurrentSpan();
}
示例6: should_wrap_runnable_in_its_sleuth_representative
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_wrap_runnable_in_its_sleuth_representative() {
SpanNamer spanNamer = new DefaultSpanNamer();
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), spanNamer,
new NoOpSpanLogger(), new NoOpSpanReporter());
Span initialSpan = tracer.createSpan("initialSpan");
// tag::trace_runnable[]
Runnable runnable = new Runnable() {
@Override
public void run() {
// do some work
}
@Override
public String toString() {
return "spanNameFromToStringMethod";
}
};
// Manual `TraceRunnable` creation with explicit "calculateTax" Span name
Runnable traceRunnable = new TraceRunnable(tracer, spanNamer, runnable, "calculateTax");
// Wrapping `Runnable` with `Tracer`. The Span name will be taken either from the
// `@SpanName` annotation or from `toString` method
Runnable traceRunnableFromTracer = tracer.wrap(runnable);
// end::trace_runnable[]
then(traceRunnable).isExactlyInstanceOf(TraceRunnable.class);
then(traceRunnableFromTracer).isExactlyInstanceOf(TraceRunnable.class);
tracer.close(initialSpan);
}
示例7: should_wrap_callable_in_its_sleuth_representative
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_wrap_callable_in_its_sleuth_representative() {
SpanNamer spanNamer = new DefaultSpanNamer();
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), spanNamer,
new NoOpSpanLogger(), new NoOpSpanReporter());
Span initialSpan = tracer.createSpan("initialSpan");
// tag::trace_callable[]
Callable<String> callable = new Callable<String>() {
@Override
public String call() throws Exception {
return someLogic();
}
@Override
public String toString() {
return "spanNameFromToStringMethod";
}
};
// Manual `TraceCallable` creation with explicit "calculateTax" Span name
Callable<String> traceCallable = new TraceCallable<>(tracer, spanNamer, callable, "calculateTax");
// Wrapping `Callable` with `Tracer`. The Span name will be taken either from the
// `@SpanName` annotation or from `toString` method
Callable<String> traceCallableFromTracer = tracer.wrap(callable);
// end::trace_callable[]
then(traceCallable).isExactlyInstanceOf(TraceCallable.class);
then(traceCallableFromTracer).isExactlyInstanceOf(TraceCallable.class);
tracer.close(initialSpan);
}
示例8: setup
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Before
public void setup() {
this.tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
new DefaultSpanNamer(), new NoOpSpanLogger(), this.spanAccumulator, new TraceKeys());
this.template.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList(
new TraceRestTemplateInterceptor(this.tracer, new ZipkinHttpSpanInjector(),
new HttpTraceKeysInjector(this.tracer, new TraceKeys()),
new ExceptionMessageErrorParser())));
TestSpanContextHolder.removeCurrentSpan();
}
示例9: setup
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Before
public void setup() {
this.tracer = new DefaultTracer(new AlwaysSampler(), new Random(),
this.spanNamer, new NoOpSpanLogger(), new NoOpSpanReporter(), new TraceKeys());
this.traceManagerableExecutorService = new TraceableExecutorService(this.executorService,
this.tracer, new TraceKeys(), this.spanNamer);
TestSpanContextHolder.removeCurrentSpan();
}
示例10: should_wrap_runnable_in_its_sleuth_representative
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_wrap_runnable_in_its_sleuth_representative() {
SpanNamer spanNamer = new DefaultSpanNamer();
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), spanNamer,
new NoOpSpanLogger(), new NoOpSpanReporter(), new TraceKeys());
Span initialSpan = tracer.createSpan("initialSpan");
// tag::trace_runnable[]
Runnable runnable = new Runnable() {
@Override
public void run() {
// do some work
}
@Override
public String toString() {
return "spanNameFromToStringMethod";
}
};
// Manual `TraceRunnable` creation with explicit "calculateTax" Span name
Runnable traceRunnable = new TraceRunnable(tracer, spanNamer, runnable, "calculateTax");
// Wrapping `Runnable` with `Tracer`. The Span name will be taken either from the
// `@SpanName` annotation or from `toString` method
Runnable traceRunnableFromTracer = tracer.wrap(runnable);
// end::trace_runnable[]
then(traceRunnable).isExactlyInstanceOf(TraceRunnable.class);
then(traceRunnableFromTracer).isExactlyInstanceOf(SpanContinuingTraceRunnable.class);
tracer.close(initialSpan);
then(this.tracer.getCurrentSpan()).isNull();
}
示例11: should_wrap_callable_in_its_sleuth_representative
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Test
public void should_wrap_callable_in_its_sleuth_representative() {
SpanNamer spanNamer = new DefaultSpanNamer();
Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), spanNamer,
new NoOpSpanLogger(), new NoOpSpanReporter(), new TraceKeys());
Span initialSpan = tracer.createSpan("initialSpan");
// tag::trace_callable[]
Callable<String> callable = new Callable<String>() {
@Override
public String call() throws Exception {
return someLogic();
}
@Override
public String toString() {
return "spanNameFromToStringMethod";
}
};
// Manual `TraceCallable` creation with explicit "calculateTax" Span name
Callable<String> traceCallable = new TraceCallable<>(tracer, spanNamer, callable, "calculateTax");
// Wrapping `Callable` with `Tracer`. The Span name will be taken either from the
// `@SpanName` annotation or from `toString` method
Callable<String> traceCallableFromTracer = tracer.wrap(callable);
// end::trace_callable[]
then(traceCallable).isExactlyInstanceOf(TraceCallable.class);
then(traceCallableFromTracer).isExactlyInstanceOf(SpanContinuingTraceCallable.class);
tracer.close(initialSpan);
}
示例12: tracer
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Bean
public DefaultTracer tracer() {
return new DefaultTracer(new AlwaysSampler(), new Random(), new DefaultSpanNamer(), new NoOpSpanLogger(),
new ArrayListSpanAccumulator(), new TraceKeys());
}
示例13: spanLogger
import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Bean
SpanLogger spanLogger() {
return new NoOpSpanLogger();
}