• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultSpanNameProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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)"));
}
 
开发者ID:redhat-helloworld-msa,项目名称:hello,代码行数:27,代码来源:HelloResource.java


示例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;
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:18,代码来源:FeginZipkinTracingClient.java


示例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;
}
 
开发者ID:junzixiehui,项目名称:godeye,代码行数:10,代码来源:ZipkinConfig.java


示例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;
}
 
开发者ID:junzixiehui,项目名称:godeye,代码行数:13,代码来源:ZipkinConfig.java


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


示例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");
}
 
开发者ID:redhat-helloworld-msa,项目名称:hello,代码行数:8,代码来源:ZipKinFilter.java


示例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);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:12,代码来源:ServerRequestInterceptor.java


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


示例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;
}
 
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:10,代码来源:HttpClientProducer.java


示例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;
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:13,代码来源:MSF4JZipkinTracingInterceptor.java


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


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


示例13: spanNameProvider

import com.github.kristofa.brave.http.DefaultSpanNameProvider; //导入依赖的package包/类
@Bean SpanNameProvider spanNameProvider() {
    return new DefaultSpanNameProvider();
}
 
开发者ID:kslisenko,项目名称:java-performance,代码行数:4,代码来源:ZipkinConfiguration.java


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ComponentWsRequest类代码示例发布时间:2022-05-22
下一篇:
Java BuilderParams类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap