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

Java SpanBytesEncoder类代码示例

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

本文整理汇总了Java中zipkin2.codec.SpanBytesEncoder的典型用法代码示例。如果您正苦于以下问题:Java SpanBytesEncoder类的具体用法?Java SpanBytesEncoder怎么用?Java SpanBytesEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: flush_incrementsMetrics

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
@Test
public void flush_incrementsMetrics() {
  reporter = AsyncReporter.builder(FakeSender.create())
      .metrics(metrics)
      .messageMaxBytes(sizeInBytesOfSingleSpanMessage)
      .messageTimeout(0, TimeUnit.MILLISECONDS)
      .build();

  // Queue up 2 spans
  reporter.report(span);
  reporter.report(span);

  reporter.flush();
  assertThat(metrics.queuedSpans()).isEqualTo(1); // still one span in the backlog
  assertThat(metrics.queuedBytes()).isEqualTo(SpanBytesEncoder.JSON_V2.encode(span).length);
  assertThat(metrics.messages()).isEqualTo(1);
  assertThat(metrics.messageBytes()).isEqualTo(sizeInBytesOfSingleSpanMessage);

  reporter.flush();
  assertThat(metrics.queuedSpans()).isZero();
  assertThat(metrics.queuedBytes()).isZero();
  assertThat(metrics.messages()).isEqualTo(2);
  assertThat(metrics.messageBytes()).isEqualTo(sizeInBytesOfSingleSpanMessage * 2);
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:25,代码来源:AsyncReporterTest.java


示例2: zipkinReporter

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
@Bean
Reporter<Span> zipkinReporter(Sender sender) {
  if (apiVersion.compareTo(CONFIG_TRACING_COLLECTOR_API_V1) == 0){
    return AsyncReporter.builder(sender).build(SpanBytesEncoder.JSON_V1);
  }

  return AsyncReporter.builder(sender).build();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:TracingConfiguration.java


示例3: Tracing

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
public Tracing() {
  String endpoint = System.getProperty("zipkin.http_endpoint");
  if (endpoint == null) {
    component = new TracingComponent.Current();
    return;
  }
  AsyncReporter<zipkin2.Span> spanReporter =
      AsyncReporter.builder(URLConnectionSender.create(endpoint))
          .build(endpoint.contains("v2") ? SpanBytesEncoder.JSON_V2 : SpanBytesEncoder.JSON_V1);
  brave.Tracing tracing = brave.Tracing.newBuilder()
      .localServiceName(System.getProperty("zipkin.service_name", "cassandra"))
      .spanReporter(spanReporter).build();
  component = new TracingComponent.Explicit(tracing);
}
 
开发者ID:openzipkin,项目名称:brave-cassandra,代码行数:15,代码来源:Tracing.java


示例4: createAndRegister

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
/**
 * Creates and registers the Zipkin Trace exporter to the OpenCensus library. Only one Zipkin
 * exporter can be registered at any point.
 *
 * @param encoder Usually {@link SpanBytesEncoder#JSON_V2}
 * @param sender Often, but not necessarily an http sender. This could be Kafka or SQS.
 * @param serviceName the {@link Span#localServiceName() local service name} of the process.
 * @throws IllegalStateException if a Zipkin exporter is already registered.
 */
public static void createAndRegister(
    SpanBytesEncoder encoder, Sender sender, String serviceName) {
  synchronized (monitor) {
    checkState(handler == null, "Zipkin exporter is already registered.");
    Handler newHandler = new ZipkinExporterHandler(encoder, sender, serviceName);
    handler = newHandler;
    register(Tracing.getExportComponent().getSpanExporter(), newHandler);
  }
}
 
开发者ID:census-instrumentation,项目名称:opencensus-java,代码行数:19,代码来源:ZipkinExporter.java


示例5: build

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
/** Builds an async reporter that encodes zipkin spans as they are reported. */
public AsyncReporter<Span> build() {
  switch (sender.encoding()) {
    case JSON:
      return build(SpanBytesEncoder.JSON_V2);
    default:
      throw new UnsupportedOperationException(sender.encoding().name());
  }
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:10,代码来源:AsyncReporter.java


示例6: create

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
static FakeSender create() {
  return new AutoValue_FakeSender(
      Encoding.JSON,
      Integer.MAX_VALUE,
      BytesMessageEncoder.forEncoding(Encoding.JSON),
      SpanBytesEncoder.JSON_V2,
      SpanBytesDecoder.JSON_V2,
      spans -> {
      }
  );
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:12,代码来源:FakeSender.java


示例7: report_incrementsMetrics

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
@Test
public void report_incrementsMetrics() {
  reporter = AsyncReporter.builder(FakeSender.create())
      .metrics(metrics)
      .messageTimeout(0, TimeUnit.MILLISECONDS)
      .build();

  reporter.report(span);
  reporter.report(span);
  assertThat(metrics.spans()).isEqualTo(2);
  assertThat(metrics.spanBytes()).isEqualTo(SpanBytesEncoder.JSON_V2.encode(span).length * 2);
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:13,代码来源:AsyncReporterTest.java


示例8: encoder

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
@Test public void encoder() {
  context = new XmlBeans(""
      + "<bean id=\"asyncReporter\" class=\"zipkin2.reporter.beans.AsyncReporterFactoryBean\">\n"
      + "  <property name=\"sender\">\n"
      + "    <util:constant static-field=\"" + getClass().getName() + ".SENDER\"/>\n"
      + "  </property>\n"
      + "  <property name=\"encoder\" value=\"JSON_V2\"/>\n"
      + "</bean>"
  );

  assertThat(context.getBean("asyncReporter", AsyncReporter.class))
      .extracting("encoder")
      .containsExactly(SpanBytesEncoder.JSON_V2);
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java


示例9: json2MessageWithThreeSpans

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
static EventData json2MessageWithThreeSpans(String offset, long sequenceNumber) throws Exception {
  List<Span> spans = IntStream.range(0, 3).mapToObj(i -> TestObjects.LOTS_OF_SPANS[i])
      .flatMap(s -> V2SpanConverter.fromSpan(s).stream())
      .collect(Collectors.toList());
  return message(offset, sequenceNumber, SpanBytesEncoder.JSON_V2.encodeList(spans));
}
 
开发者ID:openzipkin,项目名称:zipkin-azure,代码行数:7,代码来源:ZipkinEventProcessorTest.java


示例10: send

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
Call<Void> send(zipkin2.Span... spans) {
  return sender.sendSpans(Stream.of(spans)
      .map(SpanBytesEncoder.JSON_V2::encode)
      .collect(toList()));
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:6,代码来源:KinesisSenderTest.java


示例11: send

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
Call<Void> send(Span... spans) {
  return sender.sendSpans(Stream.of(spans)
      .map(SpanBytesEncoder.JSON_V2::encode)
      .collect(toList()));
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:6,代码来源:SQSSenderTest.java


示例12: ZipkinExporterHandler

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
ZipkinExporterHandler(SpanBytesEncoder encoder, Sender sender, String serviceName) {
  this.encoder = encoder;
  this.sender = sender;
  this.localEndpoint = produceLocalEndpoint(serviceName);
}
 
开发者ID:census-instrumentation,项目名称:opencensus-java,代码行数:6,代码来源:ZipkinExporterHandler.java


示例13: send

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
/** Blocks until the callback completes to allow read-your-writes consistency during tests. */
Call<Void> send(Span... spans) {
  return sender.sendSpans(Stream.of(spans)
      .map(SpanBytesEncoder.JSON_V2::encode)
      .collect(toList()));
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:7,代码来源:RabbitMQSenderTest.java


示例14: setEncoder

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
public void setEncoder(SpanBytesEncoder encoder) {
  this.encoder = encoder;
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:4,代码来源:AsyncReporterFactoryBean.java


示例15: getEncoder

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
public SpanBytesEncoder getEncoder() {
	return this.encoder;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:4,代码来源:ZipkinProperties.java


示例16: setEncoder

import zipkin2.codec.SpanBytesEncoder; //导入依赖的package包/类
public void setEncoder(SpanBytesEncoder encoder) {
	this.encoder = encoder;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:4,代码来源:ZipkinProperties.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CacheListenerAdapter类代码示例发布时间:2022-05-22
下一篇:
Java CoreAdminHandler类代码示例发布时间: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