本文整理汇总了Java中org.springframework.cloud.sleuth.SpanInjector类的典型用法代码示例。如果您正苦于以下问题:Java SpanInjector类的具体用法?Java SpanInjector怎么用?Java SpanInjector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpanInjector类属于org.springframework.cloud.sleuth包,在下文中一共展示了SpanInjector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
boolean isTraceDubbo = false;
Tracer tracer = null;
SpanInjector spanInjector = null;
try {
tracer = ApplicationContextAwareBean.CONTEXT.getBean(Tracer.class);
spanInjector = ApplicationContextAwareBean.CONTEXT.getBean(DubboSpanInjector.class);
isTraceDubbo = (tracer != null && spanInjector != null);
if (isTraceDubbo) {
String spanName = invoker.getUrl().getParameter("interface") + ":" + invocation.getMethodName() + ":" + invoker.getUrl().getParameter("version") + "(" + invoker.getUrl().getHost() + ")";
Span newSpan = tracer.createSpan(spanName);
spanInjector.inject(newSpan, RpcContext.getContext());
newSpan.logEvent(Span.CLIENT_SEND);
}
Result result = invoker.invoke(invocation);
return result;
} finally {
if (isTraceDubbo) {
if (tracer.isTracing()) {
tracer.getCurrentSpan().logEvent(Span.CLIENT_RECV);
tracer.close(tracer.getCurrentSpan());
}
}
}
}
示例2: traceWebFilter
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
public FilterRegistrationBean traceWebFilter(Tracer tracer, TraceKeys traceKeys,
SkipPatternProvider skipPatternProvider, SpanReporter spanReporter,
SpanExtractor<HttpServletRequest> spanExtractor,
SpanInjector<HttpServletResponse> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector, TraceFilter traceFilter) {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(traceFilter);
filterRegistrationBean.setDispatcherTypes(ASYNC, ERROR, FORWARD, INCLUDE, REQUEST);
return filterRegistrationBean;
}
示例3: traceFilter
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
public TraceFilter traceFilter(Tracer tracer, TraceKeys traceKeys,
SkipPatternProvider skipPatternProvider, SpanReporter spanReporter,
SpanExtractor<HttpServletRequest> spanExtractor,
SpanInjector<HttpServletResponse> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector) {
return new TraceFilter(tracer, traceKeys, skipPatternProvider.skipPattern(),
spanReporter, spanExtractor, spanInjector, httpTraceKeysInjector);
}
示例4: traceRestTemplateInterceptor
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public TraceRestTemplateInterceptor traceRestTemplateInterceptor(Tracer tracer,
SpanInjector<HttpRequest> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector) {
return new TraceRestTemplateInterceptor(tracer, spanInjector, httpTraceKeysInjector);
}
示例5: TraceAsyncClientHttpRequestFactoryWrapper
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
/**
* According to the JavaDocs all Spring {@link AsyncClientHttpRequestFactory} implement
* the {@link ClientHttpRequestFactory} interface.
*
* In case that it's not true we're setting the {@link SimpleClientHttpRequestFactory}
* as a default for sync request processing.
*
* @see org.springframework.web.client.AsyncRestTemplate#AsyncRestTemplate(AsyncClientHttpRequestFactory)
*/
public TraceAsyncClientHttpRequestFactoryWrapper(Tracer tracer,
SpanInjector<HttpRequest> spanInjector,
AsyncClientHttpRequestFactory asyncDelegate,
HttpTraceKeysInjector httpTraceKeysInjector) {
super(tracer, spanInjector, httpTraceKeysInjector);
this.asyncDelegate = asyncDelegate;
this.syncDelegate = asyncDelegate instanceof ClientHttpRequestFactory ?
(ClientHttpRequestFactory) asyncDelegate : defaultClientHttpRequestFactory();
}
示例6: TraceFilter
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
public TraceFilter(Tracer tracer, TraceKeys traceKeys, SpanReporter spanReporter,
SpanExtractor<HttpServletRequest> spanExtractor,
SpanInjector<HttpServletResponse> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector) {
this(tracer, traceKeys, Pattern.compile(DEFAULT_SKIP_PATTERN), spanReporter,
spanExtractor, spanInjector, httpTraceKeysInjector);
}
示例7: TraceRestClientRibbonCommandFactory
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
public TraceRestClientRibbonCommandFactory(SpringClientFactory clientFactory,
Tracer tracer, SpanInjector<HttpRequest.Builder> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector) {
super(clientFactory);
this.tracer = tracer;
this.spanInjector = spanInjector;
this.httpTraceKeysInjector = httpTraceKeysInjector;
}
示例8: TraceRestClientRibbonCommand
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public TraceRestClientRibbonCommand(String commandKey, RestClient restClient,
HttpRequest.Verb verb, String uri, Boolean retryable,
MultiValueMap<String, String> headers,
MultiValueMap<String, String> params, InputStream requestEntity,
Tracer tracer, SpanInjector<HttpRequest.Builder> spanInjector,
HttpTraceKeysInjector httpTraceKeysInjector)
throws URISyntaxException {
super(commandKey, restClient, verb, uri, retryable, headers, params,
requestEntity);
this.tracer = tracer;
this.spanInjector = spanInjector;
this.httpTraceKeysInjector = httpTraceKeysInjector;
}
示例9: AbstractTraceChannelInterceptor
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
protected AbstractTraceChannelInterceptor(Tracer tracer, TraceKeys traceKeys,
SpanExtractor<Message<?>> spanExtractor,
SpanInjector<MessageBuilder<?>> spanInjector) {
this.tracer = tracer;
this.traceKeys = traceKeys;
this.spanExtractor = spanExtractor;
this.spanInjector = spanInjector;
}
示例10: traceChannelInterceptor
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
@GlobalChannelInterceptor
public TraceChannelInterceptor traceChannelInterceptor(Tracer tracer,
TraceKeys traceKeys, Random random, SpanExtractor<Message<?>> spanExtractor,
SpanInjector<MessageBuilder<?>> spanInjector) {
return new IntegrationTraceChannelInterceptor(tracer, traceKeys, spanExtractor,
spanInjector);
}
示例11: dubboSpanInjector
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
public SpanInjector<RpcContext> dubboSpanInjector() {
Logger logger = Logger.getLogger(TraceDubboAutoConfiguration.class.getCanonicalName());
logger.info("生成dubbo span跟踪支持");
return new DubboSpanInjector();
}
示例12: HttpResponseInjectingTraceFilter
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
public HttpResponseInjectingTraceFilter(Tracer tracer,
SpanInjector<HttpServletResponse> spanInjector) {
this.tracer = tracer;
this.spanInjector = spanInjector;
}
示例13: customHttpServletResponseSpanInjector
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
SpanInjector<HttpServletResponse> customHttpServletResponseSpanInjector() {
return new CustomHttpServletResponseSpanInjector();
}
示例14: httpServletResponseSpanInjector
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
@Bean
public SpanInjector<HttpServletResponse> httpServletResponseSpanInjector() {
return new HttpServletResponseInjector();
}
示例15: AbstractTraceHttpRequestInterceptor
import org.springframework.cloud.sleuth.SpanInjector; //导入依赖的package包/类
protected AbstractTraceHttpRequestInterceptor(Tracer tracer,
SpanInjector<HttpRequest> spanInjector, HttpTraceKeysInjector keysInjector) {
this.tracer = tracer;
this.spanInjector = spanInjector;
this.keysInjector = keysInjector;
}