zipkin2.reporter.AsyncReporter.create()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中zipkin2.reporter.AsyncReporter.create()方法的一些代码示例,展示了AsyncReporter.create()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AsyncReporter.create()方法的具体详情如下:
包路径:zipkin2.reporter.AsyncReporter
类名称:AsyncReporter
方法名:create

AsyncReporter.create介绍

[英]Builds a json reporter for Zipkin V2. If http, the endpoint of the sender is usually "http://zipkinhost:9411/api/v2/spans".

After a certain threshold, spans are drained and Sender#sendSpans(List) to Zipkin collectors.
[中]为Zipkin V2生成json报告程序。如果是http,则发送方的端点通常为“http://zipkinhost:9411/api/v2/spans".
在某个阈值之后,将清空跨距,并将发送方#发送跨距(列表)发送给Zipkin收集器。

代码示例

代码示例来源:origin: openzipkin/brave

public Traced() {
  super(Tracing.newBuilder()
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public Unsampled() {
  super(Tracing.newBuilder()
    .sampler(Sampler.NEVER_SAMPLE)
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public Traced128() {
  super(Tracing.newBuilder()
    .traceId128Bit(true)
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public TracedExtra() {
  super(Tracing.newBuilder()
    .propagationFactory(ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY)
      .addField("x-vcap-request-id")
      .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id"))
      .build()
    )
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public OnlySampledLocal() {
  super(Tracing.newBuilder()
    .addFinishedSpanHandler(new FinishedSpanHandler() {
     @Override public boolean handle(TraceContext context, MutableSpan span) {
      return true;
     }
     @Override public boolean alwaysSampleLocal() {
      return true;
     }
    })
    .sampler(Sampler.NEVER_SAMPLE)
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: openzipkin/brave

public TracedCorrelated() {
  super(Tracing.newBuilder()
    .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder()
      // intentionally added twice to test overhead of multiple correlations
      .addScopeDecorator(ThreadContextScopeDecorator.create())
      .addScopeDecorator(ThreadContextScopeDecorator.create())
      .build())
    .spanReporter(AsyncReporter.create(new NoopSender()))
    .build());
 }
}

代码示例来源:origin: com.alipay.sofa/tracer-sofa-boot-starter

public ZipkinSofaTracerSpanRemoteReporter(RestTemplate restTemplate, String baseUrl) {
  this.sender = new ZipkinRestTemplateSender(restTemplate, baseUrl);
  this.delegate = AsyncReporter.create(sender);
}

代码示例来源:origin: openzipkin/brave-webmvc-example

/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncReporter<Span> spanReporter() {
 return AsyncReporter.create(sender());
}

代码示例来源:origin: Nike-Inc/wingtips

/**
 * @param postZipkinSpansBaseUrl The Zipkin base URL. This is everything except the endpoint path, i.e.
 * {@code http://foo.bar:9411}.
 * @return A new {@link AsyncReporter} that uses a basic {@link URLConnectionSender} for sending spans via HTTP to
 * the standard Zipkin {@code POST /api/v2/spans} endpoint.
 */
public static Reporter<zipkin2.Span> generateBasicZipkinReporter(String postZipkinSpansBaseUrl) {
  return AsyncReporter.create(
    URLConnectionSender.create(
      postZipkinSpansBaseUrl + (postZipkinSpansBaseUrl.endsWith("/") ? "" : "/") + "api/v2/spans"
    )
  );
}

代码示例来源:origin: com.nike.wingtips/wingtips-zipkin2

/**
 * @param postZipkinSpansBaseUrl The Zipkin base URL. This is everything except the endpoint path, i.e.
 * {@code http://foo.bar:9411}.
 * @return A new {@link AsyncReporter} that uses a basic {@link URLConnectionSender} for sending spans via HTTP to
 * the standard Zipkin {@code POST /api/v2/spans} endpoint.
 */
public static Reporter<zipkin2.Span> generateBasicZipkinReporter(String postZipkinSpansBaseUrl) {
  return AsyncReporter.create(
    URLConnectionSender.create(
      postZipkinSpansBaseUrl + (postZipkinSpansBaseUrl.endsWith("/") ? "" : "/") + "api/v2/spans"
    )
  );
}

代码示例来源:origin: com.alipay.sofa/sofa-tracer-zipkin-plugin

public ZipkinSofaTracerSpanRemoteReporter(RestTemplate restTemplate, String baseUrl) {
  this.zipkinV2SpanAdapter = new ZipkinV2SpanAdapter();
  this.sender = new ZipkinRestTemplateSender(restTemplate, baseUrl);
  this.delegate = AsyncReporter.create(sender);
}

代码示例来源:origin: alipay/sofa-tracer

public ZipkinSofaTracerSpanRemoteReporter(RestTemplate restTemplate, String baseUrl) {
  this.zipkinV2SpanAdapter = new ZipkinV2SpanAdapter();
  this.sender = new ZipkinRestTemplateSender(restTemplate, baseUrl);
  this.delegate = AsyncReporter.create(sender);
}

代码示例来源:origin: vmware/xenon

} else {
  sender = OkHttpSender.create(zipkinUrl);
  spanReporter = AsyncReporter.create(sender);

代码示例来源:origin: org.apache.camel/camel-zipkin

if (endpoint != null) {
  LOG.info("Configuring Zipkin URLConnectionSender using endpoint: {}", endpoint);
  spanReporter = AsyncReporter.create(URLConnectionSender.create(endpoint));
} else if (hostName != null && port > 0) {
  LOG.info("Configuring Zipkin ScribeSpanCollector using host: {} and port: {}", hostName, port);
  LibthriftSender sender = LibthriftSender.newBuilder().host(hostName).port(port).build();
  spanReporter = AsyncReporter.create(sender);
} else {
    int num = camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port);
    String implicitEndpoint = "http://" + host + ":" + num + "/api/v2/spans";
    spanReporter = AsyncReporter.create(URLConnectionSender.create(implicitEndpoint));
  } else {
    host = new ServiceHostPropertiesFunction().apply(ZIPKIN_COLLECTOR_THRIFT_SERVICE);
      int num = camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port);
      LibthriftSender sender = LibthriftSender.newBuilder().host(host).port(num).build();
      spanReporter = AsyncReporter.create(sender);

相关文章