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


Java Brave.Builder方法代码示例

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


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

示例1: test_jedis_tracer

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
@Test
public void test_jedis_tracer() throws Exception {
    Brave.Builder builder = new Brave.Builder("jedis-interceptor-test");
    builder.spanCollector(HttpSpanCollector.create("http://192.168.150.132:9411", new EmptySpanCollectorMetricsHandler()));
    builder.traceSampler(Sampler.ALWAYS_SAMPLE);
    Brave brave = builder.build();
    JaRedisInterceptor.setClientTracer(brave.clientTracer());

    JedisPoolConfig config = new JedisPoolConfig();
    JaRedisPool proxyPool = new JaRedisPool(config, "127.0.0.1", 6379);
    Jedis jedis = proxyPool.getResource();
    jedis.set("hello", "world");
    Assert.assertEquals(jedis.get("hello"), "world");
    jedis.hgetAll("hello-map");
    jedis.close();
    // sleep 3s in case spanCollector not flushed
    Thread.sleep(3000);
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:19,代码来源:TestJedisProxyPool.java

示例2: applySampling

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private static Brave.Builder applySampling(final Brave.Builder builder, final JsonObject json) {
  Sampler sampler;
  float rate;
  switch (json.getString("type", "boundary")) {
    case "counting":
      rate = json.getFloat("rate", 0.01f);
      sampler = CountingSampler.create(rate);
      break;
    case "boundary":
    default:
      rate = json.getFloat("rate", 0.001f);
      sampler = BoundarySampler.create(rate);
      break;
  }
  logger.debug("Configuring sampler: {} at rate {}", sampler, rate);
  return builder.traceSampler(sampler);
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:18,代码来源:BraveFactory.java

示例3: applySpanCollector

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private static Brave.Builder applySpanCollector(final Brave.Builder builder, final JsonObject json) {
  SpanCollector spanCollector;
  switch (json.getString("type")) {
    case "logging":
      spanCollector = new LoggingSpanCollector();
      break;
    case "scribe":
      spanCollector = ScribeSpanCollectorBuilder.build(json);
      break;
    case "kafka":
      spanCollector = KafkaSpanCollectorBuilder.build(json);
      break;
    case "empty":
    default:
      spanCollector = new EmptySpanCollector();
  }
  logger.debug("Configuring span collector: {}", spanCollector);
  return builder.spanCollector(spanCollector);
}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:20,代码来源:BraveFactory.java

示例4: getBrave

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private Brave getBrave(String serviceName) {
    Brave brave = null;
    if (serviceName != null) {
        brave = braves.get(serviceName);

        if (brave == null && useFallbackServiceNames) {
            LOG.debug("Creating Brave assigned to serviceName: {}", serviceName + " as fallback");
            Brave.Builder builder = new Brave.Builder(serviceName);
            builder = builder.traceSampler(Sampler.create(rate));
            if (spanCollector != null) {
                builder = builder.spanCollector(spanCollector);
            }
            brave = builder.build();
            braves.put(serviceName, brave);
        }
    }

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

示例5: create

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public static Brave create(final JsonObject json) {
  // TODO: not really doing any error checking on the input json.
  Brave.Builder builder = new Brave.Builder(json.getString("serviceName"));

  builder = applySampling(builder, json.getJsonObject("sampler", new JsonObject()));
  builder = applySpanCollector(builder, json.getJsonObject("collector", new JsonObject()));
  return builder.build();

}
 
开发者ID:emmanuelidi,项目名称:vertx-zipkin,代码行数:10,代码来源:BraveFactory.java

示例6: getBraveInstance

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public Brave getBraveInstance() {

        Brave.Builder builder = new Brave.Builder(name.get());

        if (this.url.isDefault()) {
            builder.reporter(new LoggingReporter())
                           .traceSampler(Sampler.create(1.0f));
        } else {
            AsyncReporter<Span> asyncReporter = AsyncReporter.builder(URLConnectionSender.create(url.get())).build();
            builder.reporter(asyncReporter)
                    .traceSampler(Sampler.create(rate.get()));
        }
        return builder.build();
    }
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:15,代码来源:ZipkinFraction.java

示例7: create

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
public Brave create() {
    final Brave.Builder builder = new Brave.Builder();
    final Brave brave = builder
            .reporter(new LoggingReporter())
            .traceSampler(Sampler.create(1.0f)) // retain 100% of traces
            .build();
    return brave;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:9,代码来源:BraveFactory.java

示例8: createBraveForService

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
private void createBraveForService(String pattern, String serviceName) {
    Brave brave = braves.get(pattern);
    if (brave == null && !braves.containsKey(serviceName)) {
        Brave.Builder builder = new Brave.Builder(serviceName);
        builder = builder.traceSampler(Sampler.create(rate));
        if (spanCollector != null) {
            builder = builder.spanCollector(spanCollector);
        }
        brave = builder.build();
        braves.put(serviceName, brave);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:ZipkinTracer.java

示例9: FeginZipkinTracingClient

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
/**
 * Constructor of FeginZipkinTracingClient.
 *
 * @param client
 * @param instanceName
 * @param zipkinUrl URL of the receiver of DAS server.
 */
public FeginZipkinTracingClient(Client client, String instanceName, String zipkinUrl) {
    this.clientDelegate = client;
    Brave.Builder builder = new Brave.Builder(instanceName);
    builder.spanCollector(HttpSpanCollector.create(zipkinUrl, new EmptySpanCollectorMetricsHandler()));
    Brave brave = builder.build();
    requestInterceptor = brave.clientRequestInterceptor();
    responseInterceptor = brave.clientResponseInterceptor();
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:16,代码来源:FeginZipkinTracingClient.java

示例10: MSF4JZipkinTracingInterceptor

import com.github.kristofa.brave.Brave; //导入方法依赖的package包/类
/**
 * Constructor of the MSF4JTracingInterceptor.
 *
 * @param microServiceName Name of the Microservice
 * @param zipkinUrl        Base URL of the Zipkin server
 */
public MSF4JZipkinTracingInterceptor(String microServiceName, String zipkinUrl) {
    Brave.Builder builder = new Brave.Builder(microServiceName);
    builder.spanCollector(HttpSpanCollector.create(zipkinUrl, new EmptySpanCollectorMetricsHandler()));
    Brave brave = builder.build();
    reqInterceptor = brave.serverRequestInterceptor();
    respInterceptor = brave.serverResponseInterceptor();
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:14,代码来源:MSF4JZipkinTracingInterceptor.java


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