Search in sources :

Example 6 with ExceptionMessageErrorParser

use of org.springframework.cloud.sleuth.ExceptionMessageErrorParser in project spring-cloud-sleuth by spring-cloud.

the class TraceableExecutorServiceTests method callables.

private List callables() {
    List list = new ArrayList<>();
    list.add(new TraceCallable<>(this.tracing.tracer(), new DefaultSpanNamer(), new ExceptionMessageErrorParser(), () -> "foo"));
    list.add((Callable) () -> "bar");
    return list;
}
Also used : ExceptionMessageErrorParser(org.springframework.cloud.sleuth.ExceptionMessageErrorParser) ArrayList(java.util.ArrayList) DefaultSpanNamer(org.springframework.cloud.sleuth.DefaultSpanNamer) ArrayList(java.util.ArrayList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList)

Example 7 with ExceptionMessageErrorParser

use of org.springframework.cloud.sleuth.ExceptionMessageErrorParser in project spring-cloud-sleuth by spring-cloud.

the class FeignRetriesTests method setup.

@Before
@After
public void setup() {
    BDDMockito.given(this.beanFactory.getBean(HttpTracing.class)).willReturn(this.httpTracing);
    BDDMockito.given(this.beanFactory.getBean(ErrorParser.class)).willReturn(new ExceptionMessageErrorParser());
}
Also used : ExceptionMessageErrorParser(org.springframework.cloud.sleuth.ExceptionMessageErrorParser) Before(org.junit.Before) After(org.junit.After)

Example 8 with ExceptionMessageErrorParser

use of org.springframework.cloud.sleuth.ExceptionMessageErrorParser in project spring-cloud-sleuth by spring-cloud.

the class TraceableScheduledExecutorServiceTest method beanFactory.

BeanFactory beanFactory() {
    BDDMockito.given(this.beanFactory.getBean(Tracer.class)).willReturn(this.tracing.tracer());
    BDDMockito.given(this.beanFactory.getBean(SpanNamer.class)).willReturn(new DefaultSpanNamer());
    BDDMockito.given(this.beanFactory.getBean(ErrorParser.class)).willReturn(new ExceptionMessageErrorParser());
    return this.beanFactory;
}
Also used : ExceptionMessageErrorParser(org.springframework.cloud.sleuth.ExceptionMessageErrorParser) DefaultSpanNamer(org.springframework.cloud.sleuth.DefaultSpanNamer)

Example 9 with ExceptionMessageErrorParser

use of org.springframework.cloud.sleuth.ExceptionMessageErrorParser in project spring-cloud-sleuth by spring-cloud.

the class SleuthHystrixConcurrencyStrategyTest method should_wrap_callable_in_trace_callable_when_delegate_is_present.

@Test
public void should_wrap_callable_in_trace_callable_when_delegate_is_present() throws Exception {
    SleuthHystrixConcurrencyStrategy strategy = new SleuthHystrixConcurrencyStrategy(this.tracing.tracer(), new DefaultSpanNamer(), new ExceptionMessageErrorParser());
    Callable<String> callable = strategy.wrapCallable(() -> "hello");
    then(callable).isInstanceOf(TraceCallable.class);
}
Also used : ExceptionMessageErrorParser(org.springframework.cloud.sleuth.ExceptionMessageErrorParser) DefaultSpanNamer(org.springframework.cloud.sleuth.DefaultSpanNamer) Test(org.junit.Test)

Example 10 with ExceptionMessageErrorParser

use of org.springframework.cloud.sleuth.ExceptionMessageErrorParser in project spring-cloud-sleuth by spring-cloud.

the class SleuthHystrixConcurrencyStrategyTest method should_add_trace_keys_when_span_is_created.

@Test
public void should_add_trace_keys_when_span_is_created() throws Exception {
    SleuthHystrixConcurrencyStrategy strategy = new SleuthHystrixConcurrencyStrategy(this.tracing.tracer(), new DefaultSpanNamer(), new ExceptionMessageErrorParser());
    Callable<String> callable = strategy.wrapCallable(() -> "hello");
    callable.call();
    then(callable).isInstanceOf(TraceCallable.class);
    then(this.reporter.getSpans()).hasSize(1);
}
Also used : ExceptionMessageErrorParser(org.springframework.cloud.sleuth.ExceptionMessageErrorParser) DefaultSpanNamer(org.springframework.cloud.sleuth.DefaultSpanNamer) Test(org.junit.Test)

Aggregations

ExceptionMessageErrorParser (org.springframework.cloud.sleuth.ExceptionMessageErrorParser)14 DefaultSpanNamer (org.springframework.cloud.sleuth.DefaultSpanNamer)12 Test (org.junit.Test)9 ErrorParser (org.springframework.cloud.sleuth.ErrorParser)4 SpanNamer (org.springframework.cloud.sleuth.SpanNamer)4 TraceRunnable (org.springframework.cloud.sleuth.instrument.async.TraceRunnable)3 Span (brave.Span)2 ExecutorService (java.util.concurrent.ExecutorService)2 Tracing (brave.Tracing)1 HttpTracing (brave.http.HttpTracing)1 HystrixThreadPoolProperties (com.netflix.hystrix.HystrixThreadPoolProperties)1 HystrixConcurrencyStrategy (com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy)1 HystrixLifecycleForwardingRequestVariable (com.netflix.hystrix.strategy.concurrency.HystrixLifecycleForwardingRequestVariable)1 HystrixProperty (com.netflix.hystrix.strategy.properties.HystrixProperty)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BlockingQueue (java.util.concurrent.BlockingQueue)1 Callable (java.util.concurrent.Callable)1 Collectors.toList (java.util.stream.Collectors.toList)1 After (org.junit.After)1