Added logging
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.web.client.feign;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Mutable holder for Feign Response headers
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class FeignResponseHeadersHolder {
|
||||
final Map<String, Collection<String>> responseHeaders;
|
||||
|
||||
FeignResponseHeadersHolder(Map<String, Collection<String>> responseHeaders) {
|
||||
this.responseHeaders = responseHeaders;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ import brave.http.HttpTracing;
|
||||
import feign.Client;
|
||||
import feign.Request;
|
||||
import feign.Response;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,8 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
*/
|
||||
class LazyTracingFeignClient implements Client {
|
||||
|
||||
private static final Log log = LogFactory.getLog(LazyTracingFeignClient.class);
|
||||
|
||||
private Client tracingFeignClient;
|
||||
private HttpTracing httpTracing;
|
||||
private final BeanFactory beanFactory;
|
||||
@@ -44,6 +48,9 @@ class LazyTracingFeignClient implements Client {
|
||||
|
||||
@Override public Response execute(Request request, Request.Options options)
|
||||
throws IOException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Sending a request via tracing feign client");
|
||||
}
|
||||
return tracingFeignClient().execute(request, options);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.io.IOException;
|
||||
|
||||
import feign.Client;
|
||||
import feign.Request;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -34,6 +36,8 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
@Aspect
|
||||
class TraceFeignAspect {
|
||||
|
||||
private static final Log log = LogFactory.getLog(TraceFeignAspect.class);
|
||||
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
TraceFeignAspect(BeanFactory beanFactory) {
|
||||
@@ -44,6 +48,9 @@ class TraceFeignAspect {
|
||||
public Object feignClientWasCalled(final ProceedingJoinPoint pjp) throws Throwable {
|
||||
Object bean = pjp.getTarget();
|
||||
Object wrappedBean = new TraceFeignObjectWrapper(this.beanFactory).wrap(bean);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Executing feign client via TraceFeignAspect");
|
||||
}
|
||||
if (bean != wrappedBean) {
|
||||
return executeTraceFeignClient(bean, pjp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user