本文整理了Java中com.github.kristofa.brave.Brave.serverTracer()
方法的一些代码示例,展示了Brave.serverTracer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Brave.serverTracer()
方法的具体详情如下:
包路径:com.github.kristofa.brave.Brave
类名称:Brave
方法名:serverTracer
[英]Server Tracer.
It is advised that you use ServerRequestInterceptor and ServerResponseInterceptor instead. Those api's build upon ServerTracer and have a higher level api.
[中]服务器跟踪器。
建议您改用ServerRequestInterceptor和ServerResponseInterceptor。这些api构建在ServerTracer之上,具有更高级别的api。
代码示例来源:origin: com.github.kristofa/brave-core-spring
@Bean
@Scope(value = "singleton")
public ServerTracer serverTracer() {
return brave.serverTracer();
}
代码示例来源:origin: io.thorntail/zipkin-jaxrs
@Override
public void stop(StopContext stopContext) {
if (this.brave != null) {
LOG.info("Shutdown Zipkin BTM services");
this.brave.serverTracer().setStateNoTracing();
}
}
代码示例来源:origin: io.zipkin.brave/brave-web-servlet-filter
protected BraveServletFilter(Builder b) { // intentionally hidden
this.requestInterceptor = b.brave.serverRequestInterceptor();
this.responseInterceptor = b.brave.serverResponseInterceptor();
this.spanNameProvider = b.spanNameProvider;
this.serverTracer = b.brave.serverTracer();
this.maybeAddClientAddressFromRequest = MaybeAddClientAddressFromRequest.create(b.brave);
}
代码示例来源:origin: io.zipkin.brave/brave-spring-web-servlet-interceptor
ServletHandlerInterceptor(Builder b) { // intentionally hidden
this.requestInterceptor = b.brave.serverRequestInterceptor();
this.responseInterceptor = b.brave.serverResponseInterceptor();
this.serverThreadBinder = b.brave.serverSpanThreadBinder();
this.spanNameProvider = b.spanNameProvider;
this.serverTracer = b.brave.serverTracer();
this.maybeAddClientAddressFromRequest = MaybeAddClientAddressFromRequest.create(b.brave);
}
代码示例来源:origin: xuminwlt/j360-dubbo-app-all
protected HttpBraveServletFilter(Builder b,Set paths) { // intentionally hidden
this.requestInterceptor = b.brave.serverRequestInterceptor();
this.responseInterceptor = b.brave.serverResponseInterceptor();
this.spanNameProvider = b.spanNameProvider;
this.serverTracer = b.brave.serverTracer();
this.maybeAddClientAddressFromRequest = MaybeAddClientAddressFromRequest.create(b.brave);
this.maybeAddClientHeaderParamFromRequest = MaybeAddClientHeaderParamFromRequest.create(b.brave);
this.serverSpanThreadBinder = b.brave.serverSpanThreadBinder();
this.appliedPaths = paths;
}
代码示例来源:origin: jgchen/brave-dubbo
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
serverRequestInterceptor.handle(new DubboServerRequestAdapter(invoker,invocation,brave.serverTracer()));
Result rpcResult = invoker.invoke(invocation);
serverResponseInterceptor.handle(new DubboServerResponseAdapter(rpcResult));
return rpcResult;
}
}
代码示例来源:origin: io.zipkin/zipkin-java-server
@Override
public void addInterceptors(InterceptorRegistry registry) {
ServerTracer tracer = brave.serverTracer();
ServletHandlerInterceptor traceInterceptor = new ServletHandlerInterceptor(
new ServerRequestInterceptor(tracer), new ServerResponseInterceptor(tracer),
new DefaultSpanNameProvider(), brave.serverSpanThreadBinder());
registry.addInterceptor(new NoPOSTHandlerInterceptorAdapter(traceInterceptor));
}
代码示例来源:origin: io.zipkin.brave/brave-http-tests
@Test
public void usesParentFromInvocationTime_server() throws Exception {
server.enqueue(new MockResponse().setBodyDelay(1, TimeUnit.SECONDS));
server.enqueue(new MockResponse());
brave.serverTracer().setStateUnknown("test");
ServerSpan parent = brave.serverSpanThreadBinder().getCurrentServerSpan();
try {
getAsync(client, "/foo");
getAsync(client, "/foo");
} finally {
brave.serverTracer().clearCurrentSpan();
}
// changing the server span after the fact!
brave.serverTracer().setStateUnknown("test");
try {
for (int i = 0; i < 2; i++) {
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("x-b3-traceId"))
.endsWith(IdConversion.convertToString(parent.getSpan().getTrace_id()));
assertThat(request.getHeader("x-b3-parentspanid"))
.endsWith(IdConversion.convertToString(parent.getSpan().getId()));
}
} finally {
brave.serverTracer().clearCurrentSpan();
}
}
代码示例来源:origin: io.zipkin.brave/brave-http-tests
@Test
public void usesExistingTraceId_server() throws Exception {
server.enqueue(new MockResponse());
brave.serverTracer().setStateUnknown("test");
ServerSpan parent = brave.serverSpanThreadBinder().getCurrentServerSpan();
try {
get(client, "/foo");
} finally {
brave.serverTracer().clearCurrentSpan();
}
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("x-b3-traceId"))
.endsWith(IdConversion.convertToString(parent.getSpan().getTrace_id()));
assertThat(request.getHeader("x-b3-parentspanid"))
.endsWith(IdConversion.convertToString(parent.getSpan().getId()));
}
内容来源于网络,如有侵权,请联系作者删除!