本文整理汇总了Java中zipkin2.reporter.AsyncReporter类的典型用法代码示例。如果您正苦于以下问题:Java AsyncReporter类的具体用法?Java AsyncReporter怎么用?Java AsyncReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AsyncReporter类属于zipkin2.reporter包,在下文中一共展示了AsyncReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ZipkinTracerFactory
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
public ZipkinTracerFactory() {
JbootOpentracingConfig config = Jboot.config(JbootOpentracingConfig.class);
URLConnectionSender sender = URLConnectionSender.newBuilder()
.endpoint(config.getUrl())
.connectTimeout(config.getConnectTimeout())
.compressionEnabled(config.isCompressionEnabled())
.readTimeout(config.getReadTimeout())
.build();
AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
.build();
Tracing tracing = Tracing.newBuilder()
.spanReporter(reporter)
.localServiceName(config.getServiceName())
.build();
tracer = BraveTracer.newBuilder(tracing).build();
}
开发者ID:yangfuhai,项目名称:jboot,代码行数:23,代码来源:ZipkinTracerFactory.java
示例2: getZipkinTracer
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
static Tracer getZipkinTracer(String serviceName) {
try {
// Configure a reporter, which controls how often spans are sent
// (the dependency is io.zipkin.reporter2:zipkin-sender-okhttp3)
final OkHttpSender sender = OkHttpSender.create("http://docker-vm:9411/api/v2/spans");
final AsyncReporter<Span> spanReporter = AsyncReporter.create(sender);
// Now, create a Brave tracing component with the service name you want to see in Zipkin.
// (the dependency is io.zipkin.brave:brave)
final Tracing braveTracing =
Tracing.newBuilder()
.localServiceName(serviceName)
.spanReporter(spanReporter)
.build();
// use this to create an OpenTracing Tracer
return BraveTracer.create(braveTracing);
} catch (Exception e) {
e.printStackTrace();
return NoopTracerFactory.create();
}
}
开发者ID:jeqo,项目名称:talk-observing-distributed-systems,代码行数:23,代码来源:TracerBuilder.java
示例3: build
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
/**
* Build a new {@link HttpTracing} instance for interfacing with Zipkin
*
* @param environment
* Environment
* @return Brave instance
*/
@Override
public Optional<HttpTracing> build(@Nonnull final Environment environment) {
if (!isEnabled()) {
LOGGER.warn("Zipkin tracing is disabled");
return Optional.empty();
}
final ReporterMetrics metricsHandler = new DropwizardReporterMetrics(
environment.metrics());
final KafkaSender sender = KafkaSender.newBuilder()
.bootstrapServers(bootstrapServers).topic(topic).build();
final AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
.metrics(metricsHandler).build();
environment.lifecycle().manage(new ReporterManager(reporter, sender));
LOGGER.info("Sending spans to Kafka topic \"{}\" at: {}", topic,
bootstrapServers);
return buildTracing(environment, reporter);
}
开发者ID:smoketurner,项目名称:dropwizard-zipkin,代码行数:31,代码来源:KafkaZipkinFactory.java
示例4: build
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
/**
* Build a new {@link HttpTracing} instance for interfacing with Zipkin
*
* @param environment
* Environment
* @return HttpTracing instance
*/
@Override
public Optional<HttpTracing> build(@Nonnull final Environment environment) {
if (!isEnabled()) {
LOGGER.warn("Zipkin tracing is disabled");
return Optional.empty();
}
final ReporterMetrics metricsHandler = new DropwizardReporterMetrics(
environment.metrics());
final URLConnectionSender sender = URLConnectionSender
.create(URI.create(baseUrl).resolve("api/v2/spans").toString());
final AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
.metrics(metricsHandler).build();
environment.lifecycle().manage(new ReporterManager(reporter, sender));
LOGGER.info("Sending spans to HTTP collector at: {}", baseUrl);
return buildTracing(environment, reporter);
}
开发者ID:smoketurner,项目名称:dropwizard-zipkin,代码行数:30,代码来源:HttpZipkinFactory.java
示例5: metrics
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void metrics() {
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=\"metrics\">\n"
+ " <util:constant static-field=\"" + getClass().getName() + ".METRICS\"/>\n"
+ " </property>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("metrics")
.containsExactly(METRICS);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:17,代码来源:AsyncReporterFactoryBeanTest.java
示例6: zipkinReporter
import zipkin2.reporter.AsyncReporter; //导入依赖的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
示例7: Tracing
import zipkin2.reporter.AsyncReporter; //导入依赖的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
示例8: build
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
/**
* Build a new {@link HttpTracing} instance for interfacing with Zipkin
*
* @param environment
* Environment
* @return Brave instance
*/
@Override
public Optional<HttpTracing> build(@Nonnull final Environment environment) {
if (!isEnabled()) {
LOGGER.warn("Zipkin tracing is disabled");
return Optional.empty();
}
final ReporterMetrics metricsHandler = new DropwizardReporterMetrics(
environment.metrics());
final RabbitMQSender sender = RabbitMQSender.newBuilder()
.addresses(addresses).queue(queue)
.connectionTimeout((int) connectionTimeout.toMilliseconds())
.username(username).password(password).virtualHost(virtualHost)
.build();
final AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
.metrics(metricsHandler).build();
environment.lifecycle().manage(new ReporterManager(reporter, sender));
LOGGER.info("Sending spans to RabbitMQ queue \"{}\" at: {}", queue,
addresses);
return buildTracing(environment, reporter);
}
开发者ID:smoketurner,项目名称:dropwizard-zipkin,代码行数:34,代码来源:RabbitMQZipkinFactory.java
示例9: createInstance
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Override protected AsyncReporter createInstance() throws Exception {
AsyncReporter.Builder builder = AsyncReporter.builder(sender);
if (metrics != null) builder.metrics(metrics);
if (messageMaxBytes != null) builder.messageMaxBytes(messageMaxBytes);
if (messageTimeout != null) builder.messageTimeout(messageTimeout, TimeUnit.MILLISECONDS);
if (closeTimeout != null) builder.closeTimeout(closeTimeout, TimeUnit.MILLISECONDS);
if (queuedMaxSpans != null) builder.queuedMaxSpans(queuedMaxSpans);
if (queuedMaxBytes != null) builder.queuedMaxBytes(queuedMaxBytes);
return builder.build(encoder);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:11,代码来源:AsyncReporterFactoryBean.java
示例10: sender
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void sender() {
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"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("sender")
.containsExactly(SENDER);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:14,代码来源:AsyncReporterFactoryBeanTest.java
示例11: messageMaxBytes
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void messageMaxBytes() {
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=\"messageMaxBytes\" value=\"512\"/>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("messageMaxBytes")
.containsExactly(512);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java
示例12: messageTimeout
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void messageTimeout() {
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=\"messageTimeout\" value=\"500\"/>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("messageTimeoutNanos")
.containsExactly(TimeUnit.MILLISECONDS.toNanos(500));
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java
示例13: closeTimeout
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void closeTimeout() {
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=\"closeTimeout\" value=\"500\"/>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("closeTimeoutNanos")
.containsExactly(TimeUnit.MILLISECONDS.toNanos(500));
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java
示例14: queuedMaxSpans
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void queuedMaxSpans() {
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=\"queuedMaxSpans\" value=\"10\"/>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("pending.maxSize")
.containsExactly(10);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java
示例15: queuedMaxBytes
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Test public void queuedMaxBytes() {
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=\"queuedMaxBytes\" value=\"512\"/>\n"
+ "</bean>"
);
assertThat(context.getBean("asyncReporter", AsyncReporter.class))
.extracting("pending.maxBytes")
.containsExactly(512);
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:15,代码来源:AsyncReporterFactoryBeanTest.java
示例16: encoder
import zipkin2.reporter.AsyncReporter; //导入依赖的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
示例17: reporter
import zipkin2.reporter.AsyncReporter; //导入依赖的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
示例18: getObjectType
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Override public Class<? extends AsyncReporter> getObjectType() {
return AsyncReporter.class;
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:4,代码来源:AsyncReporterFactoryBean.java
示例19: destroyInstance
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
@Override protected void destroyInstance(Object instance) throws Exception {
((AsyncReporter) instance).close();
}
开发者ID:openzipkin,项目名称:zipkin-reporter-java,代码行数:4,代码来源:AsyncReporterFactoryBean.java
示例20: spanReporter
import zipkin2.reporter.AsyncReporter; //导入依赖的package包/类
/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncReporter<Span> spanReporter() {
return AsyncReporter.create(sender());
}
开发者ID:openzipkin,项目名称:brave-webmvc-example,代码行数:5,代码来源:TracingConfiguration.java
注:本文中的zipkin2.reporter.AsyncReporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论