zipkin.reporter.urlconnection.URLConnectionSender Java Examples
The following examples show how to use
zipkin.reporter.urlconnection.URLConnectionSender.
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: 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 #2
Source File: Constant.java From grpc-by-example-java with Apache License 2.0 | 5 votes |
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(); }
Example #3
Source File: TracingEndpointCaller.java From odata with Apache License 2.0 | 4 votes |
public TracingEndpointCaller(Properties properties) { Integer timeout = getIntegerProperty(properties, CLIENT_CONNECTION_TIMEOUT, CLIENT_TIMEOUT_DEFAULT); String proxyServerHostName = getStringProperty(properties, CLIENT_SERVICE_PROXY_HOST_NAME); Integer proxyPort = getIntegerProperty(properties, CLIENT_SERVICE_PROXY_PORT); Integer proxyServerPort = proxyPort == null ? CLIENT_PROXY_PORT_DEFAULT : proxyPort; RequestConfig config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout) .build(); HttpClientBuilder httpClientBuilder = HttpClients.custom() .setConnectionManager(new PoolingHttpClientConnectionManager()) .setDefaultRequestConfig(config); if (!isBlank(proxyServerHostName) && proxyServerPort > 0) { httpClientBuilder.setProxy(new HttpHost(proxyServerHostName, proxyServerPort)); } // load application.properties to know zipkin host, service name and how often to collect spans Properties applicationProperties = new Properties(); try (InputStream stream = this.getClass().getResourceAsStream(APPLICATION_PROPERTIES_FILE_NAME)) { if (stream != null) { applicationProperties.load(stream); } } catch (IOException e) { LOG.warn("'{}' file is not available in the classpath", APPLICATION_PROPERTIES_FILE_NAME); } Brave brave = new Brave.Builder(applicationProperties.getProperty("spring.application.name", "cil-call")) .traceSampler(Sampler.create( Float.valueOf(applicationProperties.getProperty("spring.sleuth.sampler.percentage", "1.0")))) .reporter(AsyncReporter.builder(URLConnectionSender.builder().endpoint( applicationProperties.getProperty("spring.zipkin.baseUrl", DEFAULT_ZIPKIN_HOSTNAME)).build()) .build()).build(); closeableHttpClient = httpClientBuilder .addInterceptorFirst(BraveHttpRequestInterceptor.builder(brave).build()) //new BraveHttpRequestInterceptor(brave.clientRequestInterceptor(), //new DefaultSpanNameProvider())) .addInterceptorFirst(BraveHttpResponseInterceptor.builder(brave).build()) //new BraveHttpResponseInterceptor(brave.clientResponseInterceptor())) .build(); }