当前位置: 首页>>代码示例>>Java>>正文


Java NoOpSpanLogger类代码示例

本文整理汇总了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();
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:32,代码来源:TraceCommandTests.java

示例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();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:31,代码来源:TraceCommandTests.java

示例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();
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:10,代码来源:TraceRestTemplateInterceptorTests.java

示例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();
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:10,代码来源:TraceRestTemplateInterceptorIntegrationTests.java

示例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();
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:9,代码来源:TraceableExecutorServiceTests.java

示例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);
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:30,代码来源:SpringCloudSleuthDocTests.java

示例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);
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:30,代码来源:SpringCloudSleuthDocTests.java

示例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();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:11,代码来源:TraceRestTemplateInterceptorTests.java

示例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();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:9,代码来源:TraceableExecutorServiceTests.java

示例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();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:31,代码来源:SpringCloudSleuthDocTests.java

示例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);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:30,代码来源:SpringCloudSleuthDocTests.java

示例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());
}
 
开发者ID:eclipse,项目名称:keti,代码行数:6,代码来源:PolicyEvaluationWithAttributeConnectorIT.java

示例13: spanLogger

import org.springframework.cloud.sleuth.log.NoOpSpanLogger; //导入依赖的package包/类
@Bean
SpanLogger spanLogger() {
	return new NoOpSpanLogger();
}
 
开发者ID:reshmik,项目名称:Zipkin,代码行数:5,代码来源:StreamSpanListenerTests.java


注:本文中的org.springframework.cloud.sleuth.log.NoOpSpanLogger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。