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


Java Brave.serverSpanThreadBinder方法代码示例

本文整理汇总了Java中com.github.kristofa.brave.Brave.serverSpanThreadBinder方法的典型用法代码示例。如果您正苦于以下问题:Java Brave.serverSpanThreadBinder方法的具体用法?Java Brave.serverSpanThreadBinder怎么用?Java Brave.serverSpanThreadBinder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.kristofa.brave.Brave的用法示例。


在下文中一共展示了Brave.serverSpanThreadBinder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clientRequest

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private void clientRequest(Brave brave, String serviceName, ExchangeSendingEvent event) {
    ClientSpanThreadBinder clientBinder = brave.clientSpanThreadBinder();
    ServerSpanThreadBinder serverBinder = brave.serverSpanThreadBinder();

    // reuse existing span if we do multiple requests from the same
    ZipkinState state = event.getExchange().getProperty(ZipkinState.KEY, ZipkinState.class);
    if (state == null) {
        state = new ZipkinState();
        event.getExchange().setProperty(ZipkinState.KEY, state);
    }
    // if we started from a server span then lets reuse that when we call a downstream service
    ServerSpan last = state.peekServerSpan();
    if (last != null) {
        serverBinder.setCurrentSpan(last);
    }

    brave.clientRequestInterceptor().handle(new ZipkinClientRequestAdapter(this, serviceName, event.getExchange(), event.getEndpoint()));

    // store span after request
    Span span = clientBinder.getCurrentClientSpan();
    state.pushClientSpan(span);
    // and reset binder
    clientBinder.setCurrentSpan(null);
    serverBinder.setCurrentSpan(null);

    if (span != null && LOG.isDebugEnabled()) {
        String traceId = "" + span.getTrace_id();
        String spanId = "" + span.getId();
        String parentId = span.getParent_id() != null ? "" + span.getParent_id() : null;
        if (LOG.isDebugEnabled()) {
            if (parentId != null) {
                LOG.debug(String.format("clientRequest [service=%s, traceId=%20s, spanId=%20s, parentId=%20s]", serviceName, traceId, spanId, parentId));
            } else {
                LOG.debug(String.format("clientRequest [service=%s, traceId=%20s, spanId=%20s]", serviceName, traceId, spanId));
            }
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:39,代码来源:ZipkinTracer.java

示例2: serverRequest

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private ServerSpan serverRequest(Brave brave, String serviceName, Exchange exchange) {
    ServerSpanThreadBinder serverBinder = brave.serverSpanThreadBinder();

    // reuse existing span if we do multiple requests from the same
    ZipkinState state = exchange.getProperty(ZipkinState.KEY, ZipkinState.class);
    if (state == null) {
        state = new ZipkinState();
        exchange.setProperty(ZipkinState.KEY, state);
    }
    // if we started from a another server span then lets reuse that
    ServerSpan last = state.peekServerSpan();
    if (last != null) {
        serverBinder.setCurrentSpan(last);
    }

    brave.serverRequestInterceptor().handle(new ZipkinServerRequestAdapter(this, exchange));

    // store span after request
    ServerSpan span = serverBinder.getCurrentServerSpan();
    state.pushServerSpan(span);
    // and reset binder
    serverBinder.setCurrentSpan(null);

    if (span != null && span.getSpan() != null && LOG.isDebugEnabled()) {
        String traceId = "" + span.getSpan().getTrace_id();
        String spanId = "" + span.getSpan().getId();
        String parentId = span.getSpan().getParent_id() != null ? "" + span.getSpan().getParent_id() : null;
        if (LOG.isDebugEnabled()) {
            if (parentId != null) {
                LOG.debug(String.format("serverRequest [service=%s, traceId=%20s, spanId=%20s, parentId=%20s]", serviceName, traceId, spanId, parentId));
            } else {
                LOG.debug(String.format("serverRequest [service=%s, traceId=%20s, spanId=%20s]", serviceName, traceId, spanId));
            }
        }
    }

    return span;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:39,代码来源:ZipkinTracer.java

示例3: serverResponse

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private void serverResponse(Brave brave, String serviceName, Exchange exchange) {
    ServerSpan span = null;
    ZipkinState state = exchange.getProperty(ZipkinState.KEY, ZipkinState.class);
    if (state != null) {
        // only process if it was a zipkin server event
        span = state.popServerSpan();
    }

    if (span != null) {
        ServerSpanThreadBinder serverBinder = brave.serverSpanThreadBinder();
        serverBinder.setCurrentSpan(span);
        brave.serverResponseInterceptor().handle(new ZipkinServerResponseAdapter(this, exchange));
        // and reset binder
        serverBinder.setCurrentSpan(null);

        if (span.getSpan() != null && LOG.isDebugEnabled()) {
            String traceId = "" + span.getSpan().getTrace_id();
            String spanId = "" + span.getSpan().getId();
            String parentId = span.getSpan().getParent_id() != null ? "" + span.getSpan().getParent_id() : null;
            if (LOG.isDebugEnabled()) {
                if (parentId != null) {
                    LOG.debug(String.format("serverResponse[service=%s, traceId=%20s, spanId=%20s, parentId=%20s]", serviceName, traceId, spanId, parentId));
                } else {
                    LOG.debug(String.format("serverResponse[service=%s, traceId=%20s, spanId=%20s]", serviceName, traceId, spanId));
                }
            }
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:ZipkinTracer.java

示例4: BraveResultSetFuture

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
BraveResultSetFuture(ResultSetFuture delegate, Brave brave) {
  this.delegate = delegate;
  this.threadBinder = brave.serverSpanThreadBinder();
  this.parent = threadBinder.getCurrentServerSpan();
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:6,代码来源:TracedSession.java

示例5: ZipkinWebHandler

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public ZipkinWebHandler(final Brave brave) {
  this(brave.serverSpanThreadBinder(), brave.serverRequestInterceptor(), brave.serverResponseInterceptor());
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:4,代码来源:ZipkinWebHandler.java

示例6: ZipkinSchedulerInterceptor

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public ZipkinSchedulerInterceptor(final Brave brave) {
  this(brave.serverSpanThreadBinder(), brave.clientSpanThreadBinder());
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:4,代码来源:ZipkinSchedulerInterceptor.java

示例7: ZipkinEventBusClientInterceptor

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public ZipkinEventBusClientInterceptor(final Brave brave) {
  this(brave.serverSpanThreadBinder(), brave.clientSpanThreadBinder(),
      brave.clientRequestInterceptor(), brave.clientResponseInterceptor(), brave.localTracer());
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:5,代码来源:ZipkinEventBusClientInterceptor.java

示例8: ZipkinEventBusServerInterceptor

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public ZipkinEventBusServerInterceptor(final Brave brave) {
  this(brave.serverSpanThreadBinder(), brave.serverRequestInterceptor(), brave.serverResponseInterceptor(), brave.localTracer());
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:4,代码来源:ZipkinEventBusServerInterceptor.java

示例9: AsyncHandler

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public AsyncHandler(Client client, Brave brave) {
    this.client = Objects.requireNonNull(client);
    this.braveExecutorService = new BraveExecutorService(Executors.newFixedThreadPool(10),
            brave.serverSpanThreadBinder());
}
 
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:6,代码来源:AsyncHandler.java

示例10: UsersHandler

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public UsersHandler(UserDAO userDAO, Client client, Brave brave) {
    this.userDAO = userDAO;
    this.client = Objects.requireNonNull(client);
    this.braveExecutorService = new BraveExecutorService(Executors.newFixedThreadPool(10),
            brave.serverSpanThreadBinder());
}
 
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:7,代码来源:UsersHandler.java


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