本文整理汇总了Java中com.github.kristofa.brave.http.DefaultSpanNameProvider类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSpanNameProvider类的具体用法?Java DefaultSpanNameProvider怎么用?Java DefaultSpanNameProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSpanNameProvider类属于com.github.kristofa.brave.http包,在下文中一共展示了DefaultSpanNameProvider类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNextService
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
/**
* This is were the "magic" happens: it creates a Feign, which is a proxy interface for remote calling a REST endpoint with
* Hystrix fallback support.
*
* @return The feign pointing to the service URL and with Hystrix fallback.
*/
private NamasteService getNextService() {
final String serviceName = "namaste";
// This stores the Original/Parent ServerSpan from ZiPkin.
final ServerSpan serverSpan = brave.serverSpanThreadBinder().getCurrentServerSpan();
final CloseableHttpClient httpclient =
HttpClients.custom()
.addInterceptorFirst(new BraveHttpRequestInterceptor(brave.clientRequestInterceptor(), new DefaultSpanNameProvider()))
.addInterceptorFirst(new BraveHttpResponseInterceptor(brave.clientResponseInterceptor()))
.build();
String url = String.format("http://%s:8080/", serviceName);
return HystrixFeign.builder()
// Use apache HttpClient which contains the ZipKin Interceptors
.client(new ApacheHttpClient(httpclient))
// Bind Zipkin Server Span to Feign Thread
.requestInterceptor((t) -> brave.serverSpanThreadBinder().setCurrentSpan(serverSpan))
.logger(new Logger.ErrorLogger()).logLevel(Level.BASIC)
.decoder(new JacksonDecoder())
.target(NamasteService.class, url,
() -> Collections.singletonList("Namaste response (fallback)"));
}
示例2: execute
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Override
public Response execute(Request request, Request.Options options) throws IOException {
Map<String, Collection<String>> traceHeaders = new HashMap<>();
traceHeaders.putAll(request.headers());
Request wrappedRequest =
Request.create(request.method(), request.url(), traceHeaders, request.body(), request.charset());
HttpClientRequest httpClientRequest = new TraceableHttpClientRequest(wrappedRequest);
ClientRequestAdapter adapter = new HttpClientRequestAdapter(httpClientRequest, new DefaultSpanNameProvider());
requestInterceptor.handle(adapter);
Response response = clientDelegate.execute(wrappedRequest, options);
HttpResponse httpResponse = new TraceableHttpClientResponse(response);
ClientResponseAdapter responseAdapter = new HttpClientResponseAdapter(httpResponse);
responseInterceptor.handle(responseAdapter);
return response;
}
示例3: braveServletFilter
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Bean
public BraveServletFilter braveServletFilter(Brave brave) {
BraveServletFilter filter =
new BraveServletFilter(
brave.serverRequestInterceptor(),
brave.serverResponseInterceptor(),
new DefaultSpanNameProvider());
return filter;
}
示例4: okHttpClient
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Bean
public OkHttpClient okHttpClient(Brave brave) {
OkHttpClient client =
new OkHttpClient.Builder()
.addInterceptor(
new BraveOkHttpRequestResponseInterceptor(
brave.clientRequestInterceptor(),
brave.clientResponseInterceptor(),
new DefaultSpanNameProvider()))
.build();
return client;
}
示例5: addInterceptors
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@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(traceInterceptor);
}
示例6: contextInitialized
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
Dynamic filterRegistration = sce.getServletContext().addFilter("BraveServletFilter",
new BraveServletFilter(brave.serverRequestInterceptor(), brave.serverResponseInterceptor(), new DefaultSpanNameProvider()));
// Explicit mapping to avoid trace on readiness probe
filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/api/hello", "/api/hello-chaining");
}
示例7: ServerRequestInterceptor
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
public ServerRequestInterceptor() {
try {
this.brave = BraveLookup.lookup().get();
this.delegate = new BraveContainerRequestFilter(
brave.serverRequestInterceptor(),
new DefaultSpanNameProvider()
);
} catch (NamingException e) {
throw new RuntimeException("Failed to lookup brave", e);
}
}
示例8: ClientRequestInterceptor
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
public ClientRequestInterceptor() {
this.brave = new BraveFactory().create();
this.delegate = new BraveClientRequestFilter(
new DefaultSpanNameProvider(),
brave.clientRequestInterceptor()
);
}
示例9: getClient
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Produces
@Singleton
public Client getClient() {
Client client = ClientBuilder.newClient();
client.register(new BraveClientResponseFilter(brave.clientResponseInterceptor()))
.register(new BraveClientRequestFilter(new DefaultSpanNameProvider(), brave.clientRequestInterceptor()));
return client;
}
示例10: preCall
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
/**
* Intercepts the server request flow and extract request information
* to be published to the Zipkin server for tracing.
*/
@Override
public boolean preCall(Request request, Response responder, ServiceMethodInfo serviceMethodInfo) throws Exception {
serviceMethodInfo.setAttribute(RESPONDER_ATTRIBUTE, responder);
HttpServerRequest req = new TraceableHttpServerRequest(request);
HttpServerRequestAdapter reqAdapter = new HttpServerRequestAdapter(req, new DefaultSpanNameProvider());
reqInterceptor.handle(reqAdapter);
return true;
}
示例11: BraveModule
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
private BraveModule(Brave brave, boolean server) {
this.brave = brave;
this.server = server;
this.setSpanNameProvider(new DefaultSpanNameProvider());
}
示例12: spanNameProvider
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
/**
* Decide how to name spans. By default they are named the same as the http method.
*/
@Bean
SpanNameProvider spanNameProvider() {
return new DefaultSpanNameProvider();
}
示例13: spanNameProvider
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Bean SpanNameProvider spanNameProvider() {
return new DefaultSpanNameProvider();
}
示例14: ZipkinWebHandler
import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
public ZipkinWebHandler(final ServerSpanThreadBinder spanThreadBinder,
final ServerRequestInterceptor requestInterceptor,
final ServerResponseInterceptor responseInterceptor) {
this(spanThreadBinder, requestInterceptor, responseInterceptor, new DefaultSpanNameProvider());
}