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

Java Sender类代码示例

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

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



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

示例1: sender

import zipkin2.reporter.Sender; //导入依赖的package包/类
@Bean
Sender sender(DynamicProperties dynamicProperties) {
  apiVersion = dynamicProperties.getStringProperty(CONFIG_TRACING_COLLECTOR_API_VERSION,
      CONFIG_TRACING_COLLECTOR_API_V2).toLowerCase();
  // use default value if the user set value is invalid
  if (apiVersion.compareTo(CONFIG_TRACING_COLLECTOR_API_V1) != 0){
    apiVersion = CONFIG_TRACING_COLLECTOR_API_V2;
  }

  String path = MessageFormat.format(CONFIG_TRACING_COLLECTOR_PATH, apiVersion);
  return OkHttpSender.create(
      dynamicProperties.getStringProperty(
          CONFIG_TRACING_COLLECTOR_ADDRESS,
          DEFAULT_TRACING_COLLECTOR_ADDRESS)
          .trim()
          .replaceAll("/+$", "")
          .concat(path));
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:TracingConfiguration.java


示例2: createSender

import zipkin2.reporter.Sender; //导入依赖的package包/类
@Override protected Sender createSender() throws Exception {
  RabbitMQSender result = RabbitMQSender.newBuilder()
      .queue("zipkin-jmh")
      .addresses("localhost:5672").build();

  CheckResult check = result.check();
  if (!check.ok()) {
    throw new AssumptionViolatedException(check.error().getMessage(), check.error());
  }

  channel = result.get().createChannel();
  channel.queueDelete(result.queue());
  channel.queueDeclare(result.queue(), false, true, true, null);

  Thread.sleep(500L);

  new Thread(() -> {
    try {
      channel.basicConsume(result.queue(), true, new DefaultConsumer(channel));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }).start();

  return result;
}
 
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:27,代码来源:RabbitMQSenderBenchmarks.java


示例3: createAndRegister

import zipkin2.reporter.Sender; //导入依赖的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


示例4: zipkinReporter

import zipkin2.reporter.Sender; //导入依赖的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


示例5: reporter

import zipkin2.reporter.Sender; //导入依赖的package包/类
/**
 * Accepts a sender so you can plug-in any standard one. Returns a Reporter so you can also
 * replace with a standard one.
 */
@Bean
@ConditionalOnMissingBean
public Reporter<Span> reporter(
		SpanMetricReporter spanMetricReporter,
		ZipkinProperties zipkin,
		Sender sender
) {
	return AsyncReporter.builder(sender)
			.queuedMaxSpans(1000) // historical constraint. Note: AsyncReporter supports memory bounds
			.messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS)
			.metrics(new ReporterMetricsAdapter(spanMetricReporter))
			.build(zipkin.getEncoder());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:18,代码来源:ZipkinAutoConfiguration.java


示例6: kafkaSender

import zipkin2.reporter.Sender; //导入依赖的package包/类
@Bean Sender kafkaSender(KafkaProperties config) {
	Map<String, Object> properties = config.buildProducerProperties();
	properties.put("key.serializer", ByteArraySerializer.class.getName());
	properties.put("value.serializer", ByteArraySerializer.class.getName());
	// Kafka expects the input to be a String, but KafkaProperties returns a list
	Object bootstrapServers = properties.get("bootstrap.servers");
	if (bootstrapServers instanceof List) {
		properties.put("bootstrap.servers", join((List) bootstrapServers));
	}
	return KafkaSender.newBuilder()
			.topic(this.topic)
			.overrides(properties)
			.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:15,代码来源:ZipkinKafkaSenderConfiguration.java


示例7: restTemplateSender

import zipkin2.reporter.Sender; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public Sender restTemplateSender(ZipkinProperties zipkin,
		ZipkinRestTemplateCustomizer zipkinRestTemplateCustomizer) {
	RestTemplate restTemplate = new ZipkinRestTemplateWrapper(zipkin, this.extractor);
	zipkinRestTemplateCustomizer.customize(restTemplate);
	return new RestTemplateSender(restTemplate, zipkin.getBaseUrl(), zipkin.getEncoder());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:9,代码来源:ZipkinRestTemplateSenderConfiguration.java


示例8: rabbitSender

import zipkin2.reporter.Sender; //导入依赖的package包/类
@Bean Sender rabbitSender(CachingConnectionFactory connectionFactory, RabbitProperties config) {
	return RabbitMQSender.newBuilder()
			.connectionFactory(connectionFactory.getRabbitConnectionFactory())
			.queue(this.queue)
			.addresses(config.determineAddresses())
			.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:8,代码来源:ZipkinRabbitSenderConfiguration.java


示例9: ZipkinExporterHandler

import zipkin2.reporter.Sender; //导入依赖的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


示例10: setSender

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


示例11: sender

import zipkin2.reporter.Sender; //导入依赖的package包/类
/** Configuration for how to send spans to Zipkin */
@Bean Sender sender() {
  return OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans");
}
 
开发者ID:openzipkin,项目名称:brave-webmvc-example,代码行数:5,代码来源:TracingConfiguration.java


示例12: ReporterManager

import zipkin2.reporter.Sender; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param reporter
 *            Reporter to manage
 * @param sender
 *            Sender to manage
 */
public ReporterManager(@Nonnull final AsyncReporter<?> reporter,
        @Nonnull final Sender sender) {
    this.reporter = Objects.requireNonNull(reporter);
    this.sender = Objects.requireNonNull(sender);
}
 
开发者ID:smoketurner,项目名称:dropwizard-zipkin,代码行数:14,代码来源:ReporterManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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