Java Code Examples for com.github.kristofa.brave.Brave#Builder
The following examples show how to use
com.github.kristofa.brave.Brave#Builder .
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 |
@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 |
@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 3
Source File: ZipkinConfig.java From spring-cloud-k8s-sample with Apache License 2.0 | 5 votes |
@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 |
@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 5
Source File: ZipkinConfig.java From spring-cloud-k8s-sample with Apache License 2.0 | 5 votes |
@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: BraveConfig.java From j360-dubbo-app-all with Apache License 2.0 | 5 votes |
Brave.Builder braveBuilder(Sampler sampler) { com.twitter.zipkin.gen.Endpoint localEndpoint = com.twitter.zipkin.gen.Endpoint.builder() .ipv4(local.ipv4) .ipv6(local.ipv6) .port(local.port) .serviceName(local.serviceName) .build(); return new Brave.Builder(new InheritableServerClientAndLocalSpanState(localEndpoint)) .reporter(new Slf4jLogReporter("zipkin")) .traceSampler(sampler); }
Example 7
Source File: ApplicationConfiguration.java From j360-dubbo-app-all with Apache License 2.0 | 5 votes |
Brave.Builder braveBuilder(Sampler sampler) { com.twitter.zipkin.gen.Endpoint localEndpoint = com.twitter.zipkin.gen.Endpoint.builder() .ipv4(local.ipv4) .ipv6(local.ipv6) .port(local.port) .serviceName(local.serviceName) .build(); return new Brave.Builder(new InheritableServerClientAndLocalSpanState(localEndpoint)) .reporter(new Slf4jLogReporter("zipkin")) .traceSampler(sampler); }
Example 8
Source File: BraveConfig.java From j360-dubbo-app-all with Apache License 2.0 | 5 votes |
Brave.Builder braveBuilder(Sampler sampler) { com.twitter.zipkin.gen.Endpoint localEndpoint = com.twitter.zipkin.gen.Endpoint.builder() .ipv4(local.ipv4) .ipv6(local.ipv6) .port(local.port) .serviceName(local.serviceName) .build(); return new Brave.Builder(new InheritableServerClientAndLocalSpanState(localEndpoint)) .reporter(new Slf4jLogReporter("zipkin")) .traceSampler(sampler); }
Example 9
Source File: ZipkinFraction.java From thorntail with Apache License 2.0 | 5 votes |
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(); }
Example 10
Source File: BraveFactory.java From thorntail with Apache License 2.0 | 5 votes |
public Brave create() { final Brave.Builder builder = new Brave.Builder(); final Brave brave = builder .reporter(new LoggingReporter()) .traceSampler(Sampler.create(1.0f)) // retain 100% of traces .build(); return brave; }
Example 11
Source File: FeginZipkinTracingClient.java From msf4j with Apache License 2.0 | 5 votes |
/** * Constructor of FeginZipkinTracingClient. * * @param client * @param instanceName * @param zipkinUrl URL of the receiver of DAS server. */ public FeginZipkinTracingClient(Client client, String instanceName, String zipkinUrl) { this.clientDelegate = client; Brave.Builder builder = new Brave.Builder(instanceName); builder.spanCollector(HttpSpanCollector.create(zipkinUrl, new EmptySpanCollectorMetricsHandler())); Brave brave = builder.build(); requestInterceptor = brave.clientRequestInterceptor(); responseInterceptor = brave.clientResponseInterceptor(); }
Example 12
Source File: MSF4JZipkinTracingInterceptor.java From msf4j with Apache License 2.0 | 5 votes |
/** * Constructor of the MSF4JTracingInterceptor. * * @param microServiceName Name of the Microservice * @param zipkinUrl Base URL of the Zipkin server */ public MSF4JZipkinTracingInterceptor(String microServiceName, String zipkinUrl) { Brave.Builder builder = new Brave.Builder(microServiceName); builder.spanCollector(HttpSpanCollector.create(zipkinUrl, new EmptySpanCollectorMetricsHandler())); Brave brave = builder.build(); reqInterceptor = brave.serverRequestInterceptor(); respInterceptor = brave.serverResponseInterceptor(); }
Example 13
Source File: BraveConfig.java From j360-dubbo-app-all with Apache License 2.0 | 4 votes |
@Bean public Brave brave() { //default reporter LoggingSpanCollector Brave.Builder builder = braveBuilder(Sampler.ALWAYS_SAMPLE); return builder.build(); }
Example 14
Source File: ApplicationConfiguration.java From j360-dubbo-app-all with Apache License 2.0 | 4 votes |
@Bean public Brave brave() { //default reporter LoggingSpanCollector Brave.Builder builder = braveBuilder(Sampler.ALWAYS_SAMPLE); return builder.build(); }
Example 15
Source File: BraveConfig.java From j360-dubbo-app-all with Apache License 2.0 | 4 votes |
@Bean public Brave brave() { //default reporter LoggingSpanCollector Brave.Builder builder = braveBuilder(Sampler.ALWAYS_SAMPLE); return builder.build(); }