More refactoring
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.sleuth.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cloud.sleuth.Span;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
@@ -25,14 +26,14 @@ import org.springframework.context.ApplicationListener;
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
public class ArrayListSpanAccumulator implements ApplicationListener<SpanReleasedEvent> {
|
||||
private final ArrayList<Span> spans = new ArrayList<>();
|
||||
private final List<Span> spans = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(SpanReleasedEvent event) {
|
||||
this.spans.add(event.getSpan());
|
||||
}
|
||||
|
||||
public ArrayList<Span> getSpans() {
|
||||
public List<Span> getSpans() {
|
||||
return this.spans;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,15 +19,18 @@ import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.cloud.sleuth.TraceKeys;
|
||||
import org.springframework.cloud.sleuth.Tracer;
|
||||
import org.springframework.cloud.sleuth.instrument.hystrix.TraceCommand;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import com.netflix.hystrix.HystrixCommand;
|
||||
import com.netflix.hystrix.HystrixCommandGroupKey;
|
||||
import com.netflix.hystrix.HystrixCommandKey;
|
||||
|
||||
import feign.InvocationHandlerFactory;
|
||||
import feign.InvocationHandlerFactory.MethodHandler;
|
||||
import feign.Target;
|
||||
import org.springframework.cloud.sleuth.Tracer;
|
||||
import org.springframework.cloud.sleuth.TraceKeys;
|
||||
import org.springframework.cloud.sleuth.instrument.hystrix.TraceCommand;
|
||||
|
||||
import static feign.Util.checkNotNull;
|
||||
|
||||
@@ -64,12 +67,10 @@ final class SleuthHystrixInvocationHandler implements InvocationHandler {
|
||||
return SleuthHystrixInvocationHandler.this.dispatch.get(method)
|
||||
.invoke(args);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable t) {
|
||||
throw (Error) t;
|
||||
catch (Throwable throwable) {
|
||||
ReflectionUtils.rethrowException(throwable);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.cloud.sleuth.Span;
|
||||
*/
|
||||
public class NeverSampler implements Sampler {
|
||||
|
||||
public static NeverSampler INSTANCE = new NeverSampler();
|
||||
public static final NeverSampler INSTANCE = new NeverSampler();
|
||||
|
||||
@Override
|
||||
public boolean isSampled(Span span) {
|
||||
|
||||
@@ -51,8 +51,8 @@ public abstract class AbstractIntegrationTest {
|
||||
|
||||
private static final Log log = LogFactory.getLog(AbstractIntegrationTest.class);
|
||||
|
||||
protected static int pollInterval = 1;
|
||||
protected static int timeout = 20;
|
||||
protected static final int POLL_INTERVAL = 1;
|
||||
protected static final int TIMEOUT = 20;
|
||||
protected RestTemplate restTemplate = new AssertingRestTemplate();
|
||||
|
||||
@Before
|
||||
@@ -66,7 +66,7 @@ public abstract class AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
public static ConditionFactory await() {
|
||||
return Awaitility.await().pollInterval(pollInterval, SECONDS).atMost(timeout, SECONDS);
|
||||
return Awaitility.await().pollInterval(POLL_INTERVAL, SECONDS).atMost(TIMEOUT, SECONDS);
|
||||
}
|
||||
|
||||
protected Runnable zipkinQueryServerIsUp() {
|
||||
|
||||
@@ -44,8 +44,7 @@ public class ServerPropertiesHostLocator implements HostLocator {
|
||||
String serviceName = getServiceName(span);
|
||||
String address = getAddress();
|
||||
Integer port = getPort();
|
||||
Host ep = new Host(serviceName, address, port);
|
||||
return ep;
|
||||
return new Host(serviceName, address, port);
|
||||
}
|
||||
|
||||
@EventListener(EmbeddedServletContainerInitializedEvent.class)
|
||||
|
||||
@@ -37,7 +37,6 @@ final class SamplingZipkinSpanIterator implements Iterator<zipkin.Span> {
|
||||
|
||||
private static final Log log = org.apache.commons.logging.LogFactory
|
||||
.getLog(SamplingZipkinSpanIterator.class);
|
||||
private static final String MESSAGE_COMPONENT = "message";
|
||||
|
||||
private final Sampler sampler;
|
||||
private final Iterator<Span> delegate;
|
||||
|
||||
Reference in New Issue
Block a user