Fixed Travis script for branches

Added test to ensure that traces are cleared, added fix for Hystrix commands
This commit is contained in:
Marcin Grzejszczak
2015-12-02 19:03:24 +01:00
parent ad8ba1529f
commit c1eb04b68a
3 changed files with 89 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.sleuth.instrument.hystrix;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Trace;
import org.springframework.cloud.sleuth.TraceManager;
@@ -35,36 +36,42 @@ import com.netflix.hystrix.HystrixThreadPoolKey;
*/
public abstract class TraceCommand<R> extends HystrixCommand<R> {
private TraceManager traceManager;
private final TraceManager traceManager;
private final Span parentSpan;
protected TraceCommand(TraceManager traceManager, HystrixCommandGroupKey group) {
super(group);
this.traceManager = traceManager;
this.parentSpan = traceManager.getCurrentSpan();
}
protected TraceCommand(TraceManager traceManager, HystrixCommandGroupKey group, HystrixThreadPoolKey threadPool) {
super(group, threadPool);
this.traceManager = traceManager;
this.parentSpan = traceManager.getCurrentSpan();
}
protected TraceCommand(TraceManager traceManager, HystrixCommandGroupKey group, int executionIsolationThreadTimeoutInMilliseconds) {
super(group, executionIsolationThreadTimeoutInMilliseconds);
this.traceManager = traceManager;
this.parentSpan = traceManager.getCurrentSpan();
}
protected TraceCommand(TraceManager traceManager, HystrixCommandGroupKey group, HystrixThreadPoolKey threadPool, int executionIsolationThreadTimeoutInMilliseconds) {
super(group, threadPool, executionIsolationThreadTimeoutInMilliseconds);
this.traceManager = traceManager;
this.parentSpan = traceManager.getCurrentSpan();
}
protected TraceCommand(TraceManager traceManager, Setter setter) {
super(setter);
this.traceManager = traceManager;
this.parentSpan = traceManager.getCurrentSpan();
}
@Override
protected R run() throws Exception {
Trace trace = this.traceManager.startSpan(getCommandKey().name());
Trace trace = this.traceManager.startSpan(getCommandKey().name(), parentSpan);
try {
return doRun();
} finally {