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

Java Reporter类代码示例

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

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



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

示例1: httpTracer

import zipkin.reporter.Reporter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Tracing httpTracer(Config config, Map<String, String> properties, Reporter reporter) {

    Sampler sampler = Sampler.ALWAYS_SAMPLE;

    try {
        ServiceReference<Sampler>[] samplers =
                (ServiceReference<Sampler>[]) context.getAllServiceReferences(
                        Sampler.class.getName(), config.samplerFilter());
        if (samplers != null && samplers.length > 0) {
            sampler = context.getService(samplers[0]);
        }

    } catch (InvalidSyntaxException e) {

    }

    Tracing.Builder tracingBuilder = Tracing.newBuilder();
    tracingBuilder.localServiceName(config.localServiceName());
    tracingBuilder.sampler(sampler);
    tracingBuilder.reporter(reporter);
    tracingBuilder.currentTraceContext(MDCCurrentTraceContext.create());

    return tracingBuilder.build();
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:26,代码来源:OkHttp3ReporterExporter.java


示例2: OpentracingZipkinTracer

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


示例3: inlineBraveSetup

import zipkin.reporter.Reporter; //导入依赖的package包/类
@Test
public void inlineBraveSetup() {
    Reporter<Span> local = new Reporter<Span>() {

        @Override
        public void report(Span span) {
            spans.add(span);
        }
    };
    Brave brave = new Brave.Builder().reporter(local).build();
    brave.localTracer().startNewSpan("test", "testop");
    brave.localTracer().finishSpan();
    Assert.assertThat(1, equalTo(spans.size()));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:15,代码来源:BraveTest.java


示例4: activate

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


示例5: activate

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


示例6: SpanRecorder

import zipkin.reporter.Reporter; //导入依赖的package包/类
SpanRecorder(Reporter<Span> reporter, StatsReceiver stats, Timer timer) {
  this.reporter = reporter;
  this.unhandledReceiver = stats.scope("record").scope("unhandled");
  this.flusher = timer.schedule(ttl.$div(2L), () -> {
    flush(ttl.ago());
    return null;
  });
}
 
开发者ID:openzipkin,项目名称:zipkin-finagle,代码行数:9,代码来源:SpanRecorder.java


示例7: reporter

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


示例8: reporter

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


示例9: checkReporterUrlConnect

import zipkin.reporter.Reporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void checkReporterUrlConnect() throws InvalidSyntaxException {
    ServiceReference<Reporter> ref = getSingleService(FILTER_URLCONNECT);
    Assert.assertEquals(10000, ref.getProperty("connectTimeout"));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:7,代码来源:BraveTest.java


示例10: checkReporterKafka

import zipkin.reporter.Reporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void checkReporterKafka() throws InvalidSyntaxException {
    ServiceReference<Reporter> ref = getSingleService(FILTER_KAFKA08);
    Assert.assertEquals("zipkin", ref.getProperty("topic"));
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:7,代码来源:BraveTest.java


示例11: getSingleService

import zipkin.reporter.Reporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private ServiceReference<Reporter> getSingleService(String filter) throws InvalidSyntaxException {
    Collection<ServiceReference<Reporter>> refs = context.getServiceReferences(Reporter.class, filter);
    Assert.assertEquals(1, refs.size());
    return refs.iterator().next();
}
 
开发者ID:openzipkin,项目名称:brave-karaf,代码行数:7,代码来源:BraveTest.java


示例12: activate

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


示例13: buildReporter

import zipkin.reporter.Reporter; //导入依赖的package包/类
private Reporter<Span> buildReporter(ApplicationConfig config) {
  return AsyncReporter.builder(OkHttpSender.create(config.getZipkinUrl())).build();
}
 
开发者ID:xjdr,项目名称:xio,代码行数:4,代码来源:XioTracing.java


示例14: createBrave

import zipkin.reporter.Reporter; //导入依赖的package包/类
@Produces
@Singleton
public Brave createBrave(Reporter<Span> reporter) {
    return new Brave.Builder().reporter(reporter).build();
}
 
开发者ID:hammock-project,项目名称:hammock,代码行数:6,代码来源:BraveProducers.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java TLongObjectHashMap类代码示例发布时间:2022-05-23
下一篇:
Java ISO9796d1Encoding类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap