com.github.kristofa.brave.SpanCollector Java Examples

The following examples show how to use com.github.kristofa.brave.SpanCollector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracingConfig.java    From x7 with Apache License 2.0 6 votes vote down vote up
@ConditionalOnMissingBean(Brave.class)
@ConditionalOnBean(SpanCollector.class)
@Bean
public Brave brave(SpanCollector spanCollector, Environment env) {
    String applicationName = env.getProperty("spring.application.name");
    if (StringUtil.isNullOrEmpty(applicationName))
        throw new RuntimeException("spring.application.name=null, config it or #tracing.zipkin.url=");
    Brave.Builder builder = new Brave.Builder(applicationName);
    builder.spanCollector(spanCollector);
    builder.traceSampler(Sampler.create(properties.getSampleRate()));
    logger.info("Tracing(ZipKin): Brave instance created, default add tracing to ReyClient" );
    logger.info("Config Zipkin Servlet Tracing by: @EnableTracingServlet");
    logger.info("create more tracing filter or interceptor for spring boot project, by parameter (Brave brave), like code as follows: ");
    logger.info("       @ConditionalOnMissingBean(BraveServletFilter.class)");
    logger.info("       @ConditionalOnBean(Brave.class)");
    logger.info("       @Bean");
    logger.info("       public BraveServletFilter braveServletFilter(Brave brave) {");

    return builder.build();
}
 
Example #2
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public SpanCollector spanCollector() {
	HttpSpanCollector.Config spanConfig = HttpSpanCollector.Config.builder().compressionEnabled(false)// 默认false,span在transport之前是否会被gzipped。
			.connectTimeout(5000)// 5s,默认10s
			.flushInterval(1)// 1s
			.readTimeout(6000)// 5s,默认60s
			.build();
	return HttpSpanCollector.create(zipkinServerUrl, spanConfig, new EmptySpanCollectorMetricsHandler());
}
 
Example #3
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public Brave brave(SpanCollector spanCollector) {
	Brave.Builder builder = new Brave.Builder(applicationName);// 指定serviceName
	builder.spanCollector(spanCollector);
	builder.traceSampler(Sampler.create(1));// 采集率
	return builder.build();
}
 
Example #4
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public SpanCollector spanCollector() {
	HttpSpanCollector.Config spanConfig = HttpSpanCollector.Config.builder().compressionEnabled(false)// 默认false,span在transport之前是否会被gzipped。
			.connectTimeout(5000)// 5s,默认10s
			.flushInterval(1)// 1s
			.readTimeout(6000)// 5s,默认60s
			.build();
	return HttpSpanCollector.create(zipkinServerUrl, spanConfig, new EmptySpanCollectorMetricsHandler());
}
 
Example #5
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public Brave brave(SpanCollector spanCollector) {
	Brave.Builder builder = new Brave.Builder(applicationName);// 指定serviceName
	builder.spanCollector(spanCollector);
	builder.traceSampler(Sampler.create(1));// 采集率
	return builder.build();
}
 
Example #6
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public SpanCollector spanCollector() {
	HttpSpanCollector.Config spanConfig = HttpSpanCollector.Config.builder().compressionEnabled(false)// 默认false,span在transport之前是否会被gzipped。
			.connectTimeout(5000)// 5s,默认10s
			.flushInterval(1)// 1s
			.readTimeout(6000)// 5s,默认60s
			.build();
	return HttpSpanCollector.create(zipkinServerUrl, spanConfig, new EmptySpanCollectorMetricsHandler());
}
 
Example #7
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public Brave brave(SpanCollector spanCollector) {
	Brave.Builder builder = new Brave.Builder(applicationName);// 指定serviceName
	builder.spanCollector(spanCollector);
	builder.traceSampler(Sampler.create(1));// 采集率
	return builder.build();
}
 
Example #8
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public SpanCollector spanCollector() {
	HttpSpanCollector.Config spanConfig = HttpSpanCollector.Config.builder().compressionEnabled(false)// 默认false,span在transport之前是否会被gzipped。
			.connectTimeout(5000)// 5s,默认10s
			.flushInterval(1)// 1s
			.readTimeout(6000)// 5s,默认60s
			.build();
	return HttpSpanCollector.create(zipkinServerUrl, spanConfig, new EmptySpanCollectorMetricsHandler());
}
 
Example #9
Source File: ZipkinConfig.java    From spring-cloud-k8s-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public Brave brave(SpanCollector spanCollector) {
	Brave.Builder builder = new Brave.Builder(applicationName);// 指定serviceName
	builder.spanCollector(spanCollector);
	builder.traceSampler(Sampler.create(1));// 采集率
	return builder.build();
}
 
Example #10
Source File: TracingConfig.java    From x7 with Apache License 2.0 5 votes vote down vote up
@ConditionalOnMissingBean(Brave.class)
@ConditionalOnProperty(
        value = {"tracing.zipkin.url"})
@Bean
public SpanCollector spanCollector() {
    HttpSpanCollector.Config config = HttpSpanCollector.Config.builder().compressionEnabled(properties.isCompressionEnabled()).connectTimeout(properties.getConnectTimeout())
            .flushInterval(properties.getFlushInterval()).readTimeout(properties.getReadTimeout()).build();
    return HttpSpanCollector.create(properties.getUrl(), config, new EmptySpanCollectorMetricsHandler());
}
 
Example #11
Source File: BraveTracerConfiguration.java    From brave-tracer-example with MIT License 5 votes vote down vote up
@Bean
@Scope(value = "singleton")
public SpanCollector spanCollector() {

    // For development purposes we use the logging span collector.
    return new LoggingSpanCollectorImpl();
	//return new ZipkinSpanCollector("localhost", 9410);
}