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


Java AsyncReporter类代码示例

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


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

示例1: createZipkin

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
public static Tuple<Tracing, Flushable> createZipkin(String serviceName, String collectorUrl) {
  Sender sender = OkHttpSender.builder()
    .endpoint(collectorUrl + "/api/v1/spans")
    .encoding(Encoding.JSON)
    .build();

  AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
      .closeTimeout(1, TimeUnit.MILLISECONDS)
      .build();
  return new Tuple<>(Tracing.newBuilder()
      .localServiceName(serviceName)
      .sampler(Sampler.ALWAYS_SAMPLE)
      .traceId128Bit(true)
      .reporter(reporter)
      .build(), () -> reporter.flush());
}
 
开发者ID:jaegertracing,项目名称:spark-dependencies,代码行数:17,代码来源:TracersGenerator.java

示例2: getZipkinReporterBuilder

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
protected AsyncReporter.Builder getZipkinReporterBuilder(StagemonitorPlugin.InitArguments initArguments) {
	final ZipkinPlugin zipkinPlugin = initArguments.getPlugin(ZipkinPlugin.class);
	final AsyncReporter.Builder reporterBuilder = AsyncReporter
			.builder(getSender(zipkinPlugin))
			.messageTimeout(zipkinPlugin.getZipkinFlushInterval(), TimeUnit.MILLISECONDS);

	final Integer zipkinMaxQueuedBytes = zipkinPlugin.getZipkinMaxQueuedBytes();
	if (zipkinMaxQueuedBytes != null) {
		reporterBuilder.queuedMaxBytes(zipkinMaxQueuedBytes);
	}
	if (initArguments.getPlugin(CorePlugin.class).isInternalMonitoringActive()) {
		reporterBuilder.metrics(new StagemonitorReporterMetrics(initArguments.getMetricRegistry()));
	}

	return reporterBuilder;
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:17,代码来源:BraveZipkinReportingTracerFactory.java

示例3: main

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
public static void main(String[] args) {
    // Configure a reporter, which controls how often spans are sent
    //   (the dependency is io.zipkin.reporter:zipkin-sender-okhttp3)
    OkHttpSender sender = OkHttpSender.create("http://127.0.0.1:9411/api/v1/spans");
    AsyncReporter reporter = AsyncReporter.create(sender);

    // Create a tracing component with the service name you want to see in Zipkin.
    Tracing tracing = Tracing.newBuilder()
            .localServiceName("my-service")
            .reporter(reporter)
            .build();

    // Tracing exposes objects you might need, most importantly the tracer
    Tracer tracer = tracing.tracer();

    Span span = tracer.newTrace().name("encode").start();
    try {
        //doSomethingExpensive();
    } finally {
        span.finish();
    }

    // When all tracing tasks are complete, close the tracing component and reporter
    // This might be a shutdown hook for some users
    tracing.close();
    reporter.close();
}
 
开发者ID:TFdream,项目名称:metrics-tutorials,代码行数:28,代码来源:App.java

示例4: OpentracingZipkinTracer

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
/**
 * Creates and returns a tracer that is uses 
 * a serviceName and the location of a zipkin host/port
 * to provide tracing capability.
 *
 * @param serviceName
 * @param config
 */
public OpentracingZipkinTracer(String serviceName, Config config) {
	String traceServiceUrl = "http://"+config.host()+":"+config.port()+"/api/v1/spans";
	OkHttpSender.Builder senderBuilder = OkHttpSender.builder().endpoint(traceServiceUrl).compressionEnabled(config.compress());
	if (config.maxRequests() != Integer.MIN_VALUE) {
		senderBuilder.maxRequests(config.maxRequests());
	}
	if (config.encoding() != null) {
		senderBuilder.encoding(config.encoding());
	}
	if (config.maxMessageSize() != Integer.MIN_VALUE) {
		senderBuilder.messageMaxBytes(config.maxMessageSize());
	}
	Sender sender = senderBuilder.build();
	AsyncReporter.Builder reporterBuilder = AsyncReporter.builder(sender);
	if (config.closeTimeout() != Integer.MIN_VALUE) {
		reporterBuilder.closeTimeout(config.closeTimeout(), TimeUnit.SECONDS);
	}
	if (config.messageTimeout() != Integer.MIN_VALUE) {
		reporterBuilder.messageTimeout(config.messageTimeout(), TimeUnit.SECONDS);
	}
	if (config.queuedMaxBytes() != Integer.MIN_VALUE) {
		reporterBuilder.queuedMaxBytes(config.queuedMaxBytes());
	}
	if (config.queuedMaxSpans() != Integer.MIN_VALUE) {
		reporterBuilder.queuedMaxSpans(config.queuedMaxSpans());
	}
	Reporter<zipkin.Span> reporter = reporterBuilder.build();
	Tracing braveTracing = Tracing.newBuilder()
			.localServiceName(serviceName)
			.reporter(reporter)
			.build();
	tracer = BraveTracer.create(braveTracing);
}
 
开发者ID:WASdev,项目名称:sample.opentracing.zipkintracer,代码行数:42,代码来源:OpentracingZipkinTracer.java

示例5: activate

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Activate
public void activate(BundleContext context) {
    URLConnectionSender sender = URLConnectionSender.builder()
        .endpoint("http://localhost:9411/api/v1/spans").build();
    //KafkaSender sender = KafkaSender.builder().bootstrapServers("kafka:9092").build();
    reporter = AsyncReporter.builder(sender).build();
    Brave brave = create();
    reg = context.registerService(Brave.class, brave, null);
}
 
开发者ID:cschneider,项目名称:brave-osgi-example,代码行数:10,代码来源:BraveExporter.java

示例6: activate

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Activate
public void activate(Config config, BundleContext context, Map<String,String> properties) {
    URLConnectionSender sender = URLConnectionSender.builder()
        .endpoint(config.endpoint()) //
        .compressionEnabled(config.compressionEnabled()) //
        .connectTimeout(config.connectTimeout())
        .messageMaxBytes(config.messageMaxBytes())
        .build();
    reporter = AsyncReporter.builder(sender).build();
    reg = context.registerService(Reporter.class, reporter, new Hashtable<String, String>(properties));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:12,代码来源:SenderUrlConnectExporter.java

示例7: activate

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Activate
public void activate(Config config, BundleContext context, Map<String, String> properties) {
    this.context = context;
    OkHttpSender sender = createSender(config, properties);
    reporter = AsyncReporter.create(sender);

    reporterServiceRegistration = context.registerService(Reporter.class, reporter,
            new Hashtable<String, String>(properties));

    tracing = httpTracer(config, properties, reporter);
    tracingServiceRegistration = context.registerService(Tracing.class, tracing,
            new Hashtable<String, String>(properties));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:14,代码来源:OkHttp3ReporterExporter.java

示例8: newTracer

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
ZipkinTracer newTracer(Sender sender) {
  return new ZipkinTracer(AsyncReporter.builder(sender)
      .messageTimeout(0, TimeUnit.MILLISECONDS)
      .messageMaxBytes(176 + 5) // size of a simple span w/ 128-bit trace ID + list overhead
      .metrics(new ReporterMetricsAdapter(stats))
      .build(), () -> 1.0f, stats);
}
 
开发者ID:openzipkin,项目名称:zipkin-finagle,代码行数:8,代码来源:ZipkinTracerTest.java

示例9: brave

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
public static Brave brave(String serviceName) {
  return new Brave.Builder(serviceName)
      .traceSampler(Sampler.ALWAYS_SAMPLE)
      .reporter(AsyncReporter.builder(URLConnectionSender.builder()
          .endpoint("http://docker-machine.dev:8080/api/v1/spans")
          .build()).build())
      .build();
}
 
开发者ID:saturnism,项目名称:grpc-java-by-example,代码行数:9,代码来源:Constant.java

示例10: getBraveInstance

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

示例11: getBrave

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Produces
@Singleton
public Brave getBrave() {
    String port = System.getenv("TRACING_PORT");
    if (port == null) {
        throw new IllegalStateException("Environmental variable TRACING_PORT is not set!");
    }

    return new Brave.Builder("wildfly-swarm")
            .reporter(AsyncReporter.builder(OkHttpSender.builder()
                    .endpoint("http://tracing-server:" + port + "/api/v1/spans")
                    .build())
                .build())
            .build();
}
 
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:16,代码来源:BraveProducer.java

示例12: createZipkinTracer

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
protected Tracing createZipkinTracer(String serviceName) {
  return Tracing.newBuilder()
          .localServiceName(serviceName)
          .reporter(AsyncReporter.builder(OkHttpSender.create(zipkinUrl + "api/v1/spans"))
                  .build()).build();
}
 
开发者ID:jaegertracing,项目名称:jaeger-kubernetes,代码行数:7,代码来源:BaseETest.java

示例13: reporter

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Bean
    Reporter<Span> reporter() {
//        return new LoggingReporter(); // logs spans to console
        return AsyncReporter.builder(sender()).build(); // sends spans to zipkin
    }
 
开发者ID:kslisenko,项目名称:java-performance,代码行数:6,代码来源:ZipkinConfiguration.java

示例14: reporter

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
/** Configuration for how to buffer spans into messages for Zipkin */
    @Bean Reporter<Span> reporter() {
//        return new LoggingReporter();
        return AsyncReporter.builder(sender()).build(); // Sends to Zipkin
    }
 
开发者ID:kslisenko,项目名称:java-performance,代码行数:6,代码来源:ZipkinConfiguration.java

示例15: activate

import zipkin.reporter.AsyncReporter; //导入依赖的package包/类
@Activate
public void activate(Config config, BundleContext context, Map<String,String> properties) {
    KafkaSender sender = createSender(config, properties);
    reporter = AsyncReporter.builder(sender).build();
    reg = context.registerService(Reporter.class, reporter, new Hashtable<String, String>(properties));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:7,代码来源:KafkaReporterExporter.java


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