Fixed formatting
This commit is contained in:
@@ -36,7 +36,6 @@ public interface SpanAdjuster {
|
||||
* this interface can be used to alter then name. Example:
|
||||
*
|
||||
* {@code span -> span.toBuilder().name(scrub(span.getName())).build();}
|
||||
*
|
||||
* @param - span to adjust
|
||||
* @return - adjusted span
|
||||
*/
|
||||
|
||||
@@ -31,16 +31,13 @@ import java.lang.annotation.Target;
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Target(value = {
|
||||
ElementType.METHOD
|
||||
})
|
||||
@Target(value = { ElementType.METHOD })
|
||||
public @interface ContinueSpan {
|
||||
|
||||
/**
|
||||
* Log statement to be appended to the span.
|
||||
*
|
||||
* @return - the value passed to the annotation will be used and the framework will create two
|
||||
* events with the {@code .start} and {@code .end} suffixes.
|
||||
* @return - the value passed to the annotation will be used and the framework will
|
||||
* create two events with the {@code .start} and {@code .end} suffixes.
|
||||
*/
|
||||
String log() default "";
|
||||
|
||||
|
||||
@@ -38,21 +38,19 @@ import org.springframework.core.annotation.AliasFor;
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Target(value = {
|
||||
ElementType.METHOD
|
||||
})
|
||||
@Target(value = { ElementType.METHOD })
|
||||
public @interface NewSpan {
|
||||
|
||||
/**
|
||||
* @return - The name of the span which will be created. Default is the annotated method's name
|
||||
* separated by hyphens.
|
||||
* @return - The name of the span which will be created. Default is the annotated
|
||||
* method's name separated by hyphens.
|
||||
*/
|
||||
@AliasFor("value")
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* @return - The name of the span which will be created. Default is the annotated method's name
|
||||
* separated by hyphens.
|
||||
* @return - The name of the span which will be created. Default is the annotated
|
||||
* method's name separated by hyphens.
|
||||
*/
|
||||
@AliasFor("name")
|
||||
String value() default "";
|
||||
|
||||
@@ -29,7 +29,6 @@ public interface NewSpanParser {
|
||||
|
||||
/**
|
||||
* Override to control the name and tags on an annotation-based span.
|
||||
*
|
||||
* @param methodInvocation
|
||||
* @param newSpan
|
||||
* @param span
|
||||
|
||||
@@ -68,7 +68,6 @@ class SleuthAnnotationUtils {
|
||||
|
||||
/**
|
||||
* Searches for an annotation either on a method or inside the method parameters.
|
||||
*
|
||||
* @param <T> - annotation
|
||||
* @param clazz - class with annotation
|
||||
* @param method - annotated method
|
||||
|
||||
@@ -40,9 +40,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Target(value = {
|
||||
ElementType.PARAMETER
|
||||
})
|
||||
@Target(value = { ElementType.PARAMETER })
|
||||
public @interface SpanTag {
|
||||
|
||||
/**
|
||||
@@ -58,8 +56,8 @@ public @interface SpanTag {
|
||||
String key() default "";
|
||||
|
||||
/**
|
||||
* @return - Execute this SPEL expression to calculate the tag value. Will be analyzed if no
|
||||
* value of the {@link SpanTag#resolver()} was set.
|
||||
* @return - Execute this SPEL expression to calculate the tag value. Will be analyzed
|
||||
* if no value of the {@link SpanTag#resolver()} was set.
|
||||
*/
|
||||
String expression() default "";
|
||||
|
||||
|
||||
@@ -35,9 +35,13 @@ import org.springframework.cloud.sleuth.SpanNamer;
|
||||
public class LazyTraceExecutor implements Executor {
|
||||
|
||||
private static final Log log = LogFactory.getLog(LazyTraceExecutor.class);
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
private final Executor delegate;
|
||||
|
||||
private Tracing tracing;
|
||||
|
||||
private SpanNamer spanNamer;
|
||||
|
||||
public LazyTraceExecutor(BeanFactory beanFactory, Executor delegate) {
|
||||
|
||||
@@ -36,7 +36,8 @@ import org.springframework.cloud.sleuth.SpanNamer;
|
||||
public class TraceCallable<V> implements Callable<V> {
|
||||
|
||||
/**
|
||||
* Since we don't know the exact operation name we provide a default name for the Span.
|
||||
* Since we don't know the exact operation name we provide a default name for the
|
||||
* Span.
|
||||
*/
|
||||
private static final String DEFAULT_SPAN_NAME = "async";
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ import brave.Tracer;
|
||||
import com.netflix.hystrix.HystrixCommand;
|
||||
|
||||
/**
|
||||
* Abstraction over {@code HystrixCommand} that wraps command execution with Trace setting.
|
||||
* Abstraction over {@code HystrixCommand} that wraps command execution with Trace
|
||||
* setting.
|
||||
*
|
||||
* @param <R> - return type of Hystrix Command
|
||||
* @author Tomasz Nurkiewicz, 4financeIT
|
||||
|
||||
@@ -85,7 +85,8 @@ enum MessageHeaderPropagation
|
||||
nativeAccessor.removeNativeHeader(keyToRemove);
|
||||
}
|
||||
else {
|
||||
Object nativeHeaders = accessor.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
Object nativeHeaders = accessor
|
||||
.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
if (nativeHeaders instanceof Map) {
|
||||
((Map) nativeHeaders).remove(keyToRemove);
|
||||
}
|
||||
@@ -117,7 +118,8 @@ enum MessageHeaderPropagation
|
||||
nativeAccessor.setNativeHeader(key, value);
|
||||
}
|
||||
else {
|
||||
Object nativeHeaders = accessor.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
Object nativeHeaders = accessor
|
||||
.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
if (nativeHeaders == null) {
|
||||
accessor.setHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS,
|
||||
nativeHeaders = new LinkedMultiValueMap<>());
|
||||
@@ -162,7 +164,8 @@ enum MessageHeaderPropagation
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object nativeHeaders = accessor.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
Object nativeHeaders = accessor
|
||||
.getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS);
|
||||
if (nativeHeaders instanceof Map) {
|
||||
Object result = ((Map) nativeHeaders).get(key);
|
||||
if (result instanceof List && !((List) result).isEmpty()) {
|
||||
|
||||
@@ -199,8 +199,11 @@ class SleuthRabbitBeanPostProcessor implements BeanPostProcessor {
|
||||
class SleuthKafkaAspect {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SleuthKafkaAspect.class);
|
||||
|
||||
final Field recordMessageConverter;
|
||||
|
||||
private final KafkaTracing kafkaTracing;
|
||||
|
||||
private final Tracer tracer;
|
||||
|
||||
SleuthKafkaAspect(KafkaTracing kafkaTracing, Tracer tracer) {
|
||||
|
||||
@@ -80,12 +80,19 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
* "http.route".
|
||||
*/
|
||||
private static final String REMOTE_SERVICE_NAME = "broker";
|
||||
|
||||
final Tracing tracing;
|
||||
|
||||
final Tracer tracer;
|
||||
|
||||
final ThreadLocalSpan threadLocalSpan;
|
||||
|
||||
final TraceContext.Injector<MessageHeaderAccessor> injector;
|
||||
|
||||
final TraceContext.Extractor<MessageHeaderAccessor> extractor;
|
||||
|
||||
final boolean integrationObjectSupportPresent;
|
||||
|
||||
private final boolean hasDirectChannelClass;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -97,6 +97,7 @@ class SleuthRxJavaSchedulersHook extends RxJavaSchedulersHook {
|
||||
|
||||
/**
|
||||
* Wrapped Action element.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
static class TraceAction implements Action0 {
|
||||
|
||||
@@ -120,6 +120,7 @@ public class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* Web client properties.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public static class Client {
|
||||
@@ -155,6 +156,7 @@ public class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* Async computing properties.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public static class Async {
|
||||
@@ -174,6 +176,7 @@ public class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* Async client properties.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public static class AsyncClient {
|
||||
@@ -207,6 +210,7 @@ public class SleuthWebProperties {
|
||||
|
||||
/**
|
||||
* Async Rest Template properties.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public static class Template {
|
||||
|
||||
@@ -54,6 +54,7 @@ public final class TraceWebFilter implements WebFilter, Ordered {
|
||||
* logs will not get correlated.
|
||||
*/
|
||||
public static final int ORDER = TraceHttpAutoConfiguration.TRACING_FILTER_ORDER;
|
||||
|
||||
protected static final String TRACE_REQUEST_ATTR = TraceWebFilter.class.getName()
|
||||
+ ".TRACE";
|
||||
static final String MVC_CONTROLLER_CLASS_KEY = "mvc.controller.class";
|
||||
@@ -70,11 +71,16 @@ public final class TraceWebFilter implements WebFilter, Ordered {
|
||||
return "HttpHeaders::getFirst";
|
||||
}
|
||||
};
|
||||
|
||||
private static final Log log = LogFactory.getLog(TraceWebFilter.class);
|
||||
|
||||
private static final String STATUS_CODE_KEY = "http.status_code";
|
||||
|
||||
private static final String TRACE_SPAN_WITHOUT_PARENT = TraceWebFilter.class.getName()
|
||||
+ ".SPAN_WITH_NO_PARENT";
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
Tracer tracer;
|
||||
|
||||
HttpServerHandler<ServerHttpRequest, ServerHttpResponse> handler;
|
||||
|
||||
@@ -376,11 +376,16 @@ class TracingHttpClientInstrumentation {
|
||||
return "HttpHeaders::get";
|
||||
}
|
||||
};
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(TracingHttpClientInstrumentation.class);
|
||||
|
||||
final Tracer tracer;
|
||||
|
||||
final HttpClientHandler<HttpClientRequest, HttpClientResponse> handler;
|
||||
|
||||
final TraceContext.Injector<HttpHeaders> injector;
|
||||
|
||||
final HttpTracing httpTracing;
|
||||
|
||||
TracingHttpClientInstrumentation(HttpTracing httpTracing) {
|
||||
@@ -462,6 +467,7 @@ class TracingHttpClientInstrumentation {
|
||||
static class TracedHttpClientRequest implements HttpClientRequest {
|
||||
|
||||
private final io.netty.handler.codec.http.HttpHeaders addedHeaders;
|
||||
|
||||
private HttpClientRequest delegate;
|
||||
|
||||
TracedHttpClientRequest(HttpClientRequest delegate, HttpHeaders addedHeaders) {
|
||||
|
||||
@@ -109,12 +109,19 @@ class TraceExchangeFilterFunction implements ExchangeFilterFunction {
|
||||
return "HttpHeaders::getFirst";
|
||||
}
|
||||
};
|
||||
|
||||
private static final Log log = LogFactory.getLog(TraceExchangeFilterFunction.class);
|
||||
|
||||
private static final String CLIENT_SPAN_KEY = "sleuth.webclient.clientSpan";
|
||||
|
||||
final BeanFactory beanFactory;
|
||||
|
||||
Tracer tracer;
|
||||
|
||||
HttpTracing httpTracing;
|
||||
|
||||
HttpClientHandler<ClientRequest, ClientResponse> handler;
|
||||
|
||||
TraceContext.Injector<ClientRequest.Builder> injector;
|
||||
|
||||
TraceExchangeFilterFunction(BeanFactory beanFactory) {
|
||||
|
||||
@@ -35,9 +35,13 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
class LazyTracingFeignClient implements Client {
|
||||
|
||||
private static final Log log = LogFactory.getLog(LazyTracingFeignClient.class);
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
private final Client delegate;
|
||||
|
||||
private Client tracingFeignClient;
|
||||
|
||||
private HttpTracing httpTracing;
|
||||
|
||||
LazyTracingFeignClient(BeanFactory beanFactory, Client delegate) {
|
||||
|
||||
@@ -43,7 +43,9 @@ final class TraceFeignObjectWrapper {
|
||||
}
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
private CachingSpringLoadBalancerFactory cachingSpringLoadBalancerFactory;
|
||||
|
||||
private Object springClientFactory;
|
||||
|
||||
TraceFeignObjectWrapper(BeanFactory beanFactory) {
|
||||
|
||||
@@ -67,9 +67,13 @@ final class TracingFeignClient implements Client {
|
||||
return "Map::set";
|
||||
}
|
||||
};
|
||||
|
||||
final Tracer tracer;
|
||||
|
||||
final Client delegate;
|
||||
|
||||
final HttpClientHandler<Request, Response> handler;
|
||||
|
||||
final TraceContext.Injector<Map<String, Collection<String>>> injector;
|
||||
|
||||
TracingFeignClient(HttpTracing httpTracing, Client delegate) {
|
||||
|
||||
@@ -123,6 +123,7 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext {
|
||||
|
||||
/**
|
||||
* Thread context scope.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
class ThreadContextCurrentTraceContextScope implements Scope {
|
||||
|
||||
@@ -100,8 +100,8 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator {
|
||||
log.trace("With parent: {}", currentSpan.parentId());
|
||||
}
|
||||
}
|
||||
whitelistedBaggageKeys(currentSpan)
|
||||
.forEach((s) -> MDC.put(s, ExtraFieldPropagation.get(currentSpan, s)));
|
||||
whitelistedBaggageKeys(currentSpan).forEach(
|
||||
(s) -> MDC.put(s, ExtraFieldPropagation.get(currentSpan, s)));
|
||||
}
|
||||
else {
|
||||
MDC.remove("traceId");
|
||||
@@ -117,6 +117,7 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator {
|
||||
|
||||
/**
|
||||
* Thread context scope.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
class ThreadContextCurrentTraceContextScope implements CurrentTraceContext.Scope {
|
||||
|
||||
@@ -80,7 +80,6 @@ public class ProbabilityBasedSampler extends Sampler {
|
||||
* Reservoir sampling algorithm borrowed from Stack Overflow.
|
||||
*
|
||||
* http://stackoverflow.com/questions/12817946/generate-a-random-bitset-with-n-1s
|
||||
*
|
||||
* @param size
|
||||
* @param cardinality
|
||||
* @param rnd
|
||||
|
||||
@@ -36,7 +36,8 @@ public final class SpanNameUtil {
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return name;
|
||||
}
|
||||
int maxLength = name.length() > MAX_NAME_LENGTH ? (MAX_NAME_LENGTH) : (name.length());
|
||||
int maxLength = name.length() > MAX_NAME_LENGTH ? (MAX_NAME_LENGTH)
|
||||
: (name.length());
|
||||
return name.substring(0, maxLength);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user