Java Code Examples for brave.http.HttpTracing#create()
The following examples show how to use
brave.http.HttpTracing#create() .
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: ITHttpServer.java From brave with Apache License 2.0 | 6 votes |
@Test public void createsChildWhenJoinDisabled() throws IOException { tracing = tracingBuilder(NEVER_SAMPLE).supportsJoin(false).build(); httpTracing = HttpTracing.create(tracing); init(); String path = "/foo"; TraceContext parent = newTraceContext(SamplingFlags.SAMPLED); get(new Request.Builder().url(url(path)) .header("b3", B3SingleFormat.writeB3SingleFormat(parent)) .build()); MutableSpan span = testSpanHandler.takeRemoteSpan(SERVER); assertChildOf(span, parent); assertThat(span.id()).isNotEqualTo(parent.spanIdString()); }
Example 2
Source File: AwsClientTracingTest.java From zipkin-aws with Apache License 2.0 | 6 votes |
@Before public void setup() { String endpoint = "http://localhost:" + mockServer.getPort(); HttpTracing httpTracing = HttpTracing.create(tracing); AmazonDynamoDBClientBuilder clientBuilder = AmazonDynamoDBClientBuilder.standard() .withCredentials( new AWSStaticCredentialsProvider(new BasicAWSCredentials("access", "secret"))) .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(endpoint, "us-east-1")); dbClient = AwsClientTracing.create(httpTracing).build(clientBuilder); s3Client = AwsClientTracing.create(httpTracing).build(AmazonS3ClientBuilder.standard() .withCredentials( new AWSStaticCredentialsProvider(new BasicAWSCredentials("access", "secret"))) .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(endpoint, "us-east-1")) .enableForceGlobalBucketAccess()); }
Example 3
Source File: TraceFilterTests.java From spring-cloud-sleuth with Apache License 2.0 | 6 votes |
@Test public void createsChildFromHeadersWhenJoinUnsupported() throws Exception { Tracing tracing = Tracing.newBuilder() .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder() .addScopeDecorator(StrictScopeDecorator.create()).build()) .addSpanHandler(this.spans).supportsJoin(false).build(); HttpTracing httpTracing = HttpTracing.create(tracing); this.request = builder().header("b3", "0000000000000014-000000000000000a") .buildRequest(new MockServletContext()); TracingFilter.create(httpTracing).doFilter(this.request, this.response, this.filterChain); then(Tracing.current().tracer().currentSpan()).isNull(); then(this.spans).hasSize(1); then(this.spans.get(0).parentId()).isEqualTo("000000000000000a"); }
Example 4
Source File: ITHttpClient.java From brave with Apache License 2.0 | 5 votes |
/** * This ensures custom span handlers can see the actual exception thrown, not just the "error" * tag value. */ void spanHandlerSeesError(Callable<Void> get) throws IOException { ConcurrentLinkedDeque<Throwable> caughtThrowables = new ConcurrentLinkedDeque<>(); closeClient(client); httpTracing = HttpTracing.create(tracingBuilder(Sampler.ALWAYS_SAMPLE) .clearSpanHandlers() .addSpanHandler(new SpanHandler() { @Override public boolean end(TraceContext context, MutableSpan span, Cause cause) { Throwable error = span.error(); if (error != null) { caughtThrowables.add(error); } else { caughtThrowables.add(new RuntimeException("Unexpected additional call to end")); } return true; } }) // The blocking span handler goes after the error catcher, so we can assert on the errors. .addSpanHandler(testSpanHandler) .build()); client = newClient(server.getPort()); // If this passes, a span was reported with an error checkReportsSpanOnTransportException(get); assertThat(caughtThrowables) .withFailMessage("Span finished with error, but caughtThrowables empty") .isNotEmpty(); if (caughtThrowables.size() > 1) { for (Throwable throwable : caughtThrowables) { Logger.getAnonymousLogger().log(Level.SEVERE, "multiple calls to finish", throwable); } assertThat(caughtThrowables).hasSize(1); } }
Example 5
Source File: ITHttpServer.java From brave with Apache License 2.0 | 5 votes |
@Test public void samplingDisabled() throws IOException { httpTracing = HttpTracing.create(tracingBuilder(Sampler.NEVER_SAMPLE).build()); init(); get("/foo"); // @After will check that nothing is reported }
Example 6
Source File: AwsClientTracingTest.java From zipkin-aws with Apache License 2.0 | 5 votes |
@Test public void buildingAsyncClientWithEmptyConfigDoesNotThrowExceptions() { HttpTracing httpTracing = HttpTracing.create(tracing); environmentVariables.set("AWS_REGION", "us-east-1"); AwsClientTracing.create(httpTracing).build(AmazonDynamoDBAsyncClientBuilder.standard()); }
Example 7
Source File: ITHttpServer.java From brave with Apache License 2.0 | 5 votes |
void spanHandlerSeesError(String path) throws IOException { ConcurrentLinkedDeque<Throwable> caughtThrowables = new ConcurrentLinkedDeque<>(); httpTracing = HttpTracing.create(tracingBuilder(Sampler.ALWAYS_SAMPLE) .clearSpanHandlers() .addSpanHandler(new SpanHandler() { @Override public boolean end(TraceContext context, MutableSpan span, Cause cause) { Throwable error = span.error(); if (error != null) { caughtThrowables.add(error); } else { caughtThrowables.add(new RuntimeException("Unexpected additional call to end")); } return true; } }) // The blocking span handler goes after the error catcher, so we can assert on the errors. .addSpanHandler(testSpanHandler) .build()); init(); // If this passes, a span was reported with an error httpStatusCodeTagMatchesResponse_onUncaughtException(path, ".*not ready"); assertThat(caughtThrowables) .withFailMessage("Span finished with error, but caughtThrowables empty") .isNotEmpty(); if (caughtThrowables.size() > 1) { for (Throwable throwable : caughtThrowables) { Logger.getAnonymousLogger().log(Level.SEVERE, "multiple calls to finish", throwable); } assertThat(caughtThrowables).hasSize(1); } }
Example 8
Source File: HttpServerTracingHandlerTest.java From xio with Apache License 2.0 | 4 votes |
@Before public void setup() throws Exception { httpTracing = HttpTracing.create(tracingBuilder(Sampler.ALWAYS_SAMPLE).build()); BraveTracer braveTracer = BraveTracer.create(httpTracing.tracing()); httpTracingState = new HttpServerTracingDispatch("test", braveTracer); }
Example 9
Source File: NettyHttpTracing.java From brave with Apache License 2.0 | 4 votes |
public static NettyHttpTracing create(Tracing tracing) { return new NettyHttpTracing(HttpTracing.create(tracing)); }
Example 10
Source File: TracingCachingHttpClientBuilder.java From brave with Apache License 2.0 | 4 votes |
public static CachingHttpClientBuilder create(Tracing tracing) { return new TracingCachingHttpClientBuilder(HttpTracing.create(tracing)); }
Example 11
Source File: TracingConfiguration.java From brave-webmvc-example with MIT License | 4 votes |
/** Decides how to name and tag spans. By default they are named the same as the http method. */ @Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 12
Source File: TracingConfiguration.java From brave-webmvc-example with MIT License | 4 votes |
/** Decides how to name and tag spans. By default they are named the same as the http method. */ @Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 13
Source File: TracingClientHttpRequestInterceptorAutowireTest.java From brave with Apache License 2.0 | 4 votes |
@Bean HttpTracing httpTracing() { return HttpTracing.create(Tracing.newBuilder().build()); }
Example 14
Source File: TracingConfiguration.java From txle with Apache License 2.0 | 4 votes |
@Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 15
Source File: TracingAsyncClientHttpRequestInterceptorAutowireTest.java From brave with Apache License 2.0 | 4 votes |
@Bean HttpTracing httpTracing() { return HttpTracing.create(Tracing.newBuilder().build()); }
Example 16
Source File: TracingConfiguration.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 4 votes |
/** Decides how to name and tag spans. By default they are named the same as the http method. */ @Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 17
Source File: TracingConfiguration.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 4 votes |
/** Decides how to name and tag spans. By default they are named the same as the http method */ @Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 18
Source File: ZipkinConfig.java From j360-boot-app-all with Apache License 2.0 | 4 votes |
/** Decides how to name and tag spans. By default they are named the same as the http method */ @Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }
Example 19
Source File: TracingClientFilter.java From brave with Apache License 2.0 | 4 votes |
public static TracingClientFilter create(Tracing tracing) { return new TracingClientFilter(HttpTracing.create(tracing)); }
Example 20
Source File: TracingConfiguration.java From txle with Apache License 2.0 | 4 votes |
@Bean HttpTracing httpTracing(Tracing tracing) { return HttpTracing.create(tracing); }